GithubHelp home page GithubHelp logo

Comments (6)

tomas avatar tomas commented on July 19, 2024

Good to know. Can you send an example of a server that sends a 303?

from needle.

haohcraft avatar haohcraft commented on July 19, 2024

@flore2003 I think you should set cookie in the header when 302, so in the lib/needle.js:

   if ([301, 302].indexOf(resp.statusCode) != -1 && headers.location) {
         if (count <= config.follow) {
         // --------------------------------------------------
         // must set cookie
         var cookies = headers['set-cookie'];
      if ( cookies ) {
        config.base_opts.headers.Cookie = cookies[0];
      }
      // --------------------------------------------------
       out.emit('redirect', headers.location);

Credits: #40

from needle.

tomas avatar tomas commented on July 19, 2024

Needle doesn't handle cookies (yet) , but I'd be happy to merge a Pull Request with some tests. :)

from needle.

flore2003 avatar flore2003 commented on July 19, 2024

@haohcraft I don't understand what your comment has to do with this issue.
This issue is about HTTP Status 303 See Other, which is a valid response code for example for a POST request that creates a resource. The location header will be set to the location of the newly created resource.

@tomas I don't have an example for a public facing server that responds with a 303, but you can read more about it in the HTTP 1.1 RFC! http://tools.ietf.org/html/rfc2616#page-63

from needle.

tomas avatar tomas commented on July 19, 2024

@flore2003 303 handling is already on master. I just pushed a branch that includes a couple of other enhancements to the redirect follow logic, that should be merged once I get all the specs to pass. Then I'll be pushing a new version over to npmjs.org. :)

from needle.

flore2003 avatar flore2003 commented on July 19, 2024

@tomas Great! I'll check it out =)

from needle.

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.