Giter VIP home page Giter VIP logo

Comments (4)

seejohnrun avatar seejohnrun commented on June 23, 2024

Have this implemented off in the jsonp branch - let me know if this fits the bill
Thanks for the feature request

from haste-server.

rdebeasi avatar rdebeasi commented on June 23, 2024

That's exciting news - thanks very much!

I'm having trouble getting this feature to work with my JavaScript "client." When I try to submit data via JSONP, I get back the HTML for Hastebin rather than JSON containing a key.

As a test, I tried a submitting form to my local instance of Hastebin normally, with no JavaScript. When I used POST to send the data, I received a key as expected. When I used GET to send the data, my browser navigated to http://0.0.0.0:7777/documents/?data=jhklhkljh, which gave me the HTML for Hastebin.

So, it sounds like I'd need to use POST instead of GET. The problem is that JSONP works only with GET, not POST. Additionally, GET is probably not well-suited for submitting large blocks of code.

Any thoughts on what might be going on here? Am I misunderstanding how to interact with haste-server? Should I be using CORS instead of JSONP? If it helps, you can see my extremely basic "client" code at https://github.com/rdebeasi/post-haste.

Thanks again for your help, and my apologies if the JSONP suggestion turns out to be a bad idea.

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Ahh I think I may have misunderstood the original goal.
The branch will allow retrieval of haste data for a given key via JSONP

I'm a bit wary to take in data for hastes over GET.

Maybe it's an idea to offer a library you can use on your site - which is hosted on the hastebin domain to create documents (similar to the approach taken with stripe.js) which would allow for CORS

Do you have some more details on your use case? There's always the ability have a smaller server that created the pastes but that may be too heavyweight

from haste-server.

seejohnrun avatar seejohnrun commented on June 23, 2024

Please re-open if any other questions!

from haste-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.