Comments (6)
Good to know. Can you send an example of a server that sends a 303?
from needle.
@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.
Needle doesn't handle cookies (yet) , but I'd be happy to merge a Pull Request with some tests. :)
from needle.
@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.
@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.
@tomas Great! I'll check it out =)
from needle.
Related Issues (20)
- Very infrequent TypeError: iconv.encodingExists is not a function
- Tunnelling doesn't work in v3.1.0 HOT 12
- Proposal: Supporting User-Defined "Follow If" Conditions
- Piping needle request to Express response won't set the correct headers
- Multiple Files Upload Renames Input Field
- Uncaught asynchronous error
- Remote end closed socket abruptly errors HOT 2
- a ':' in nonce breaks digest authentication HOT 1
- Digest MD5 not working with Geovision IP Camera
- Uncaught ECONNRESET exception
- needle.get cannot guaranty getting the http stream HOT 2
- FEATURE: Retry HOT 1
- follow_set_cookies -> not working!!!
- Bug in 3.3.0: accidental creation of `global.signal`, gets caught in strict UTs
- README recommends mikeal's request HOT 3
- Multipart uploads strips date values in the request body HOT 2
- Doesn't work in Cloudflare Workers HOT 1
- Sorry, I was about to post this issue to a different repo, don't even know how it happened that I posted it here
- `get` with redirect leads to ~30sec hang HOT 7
- Invalid protocol causes uncatchable error in node:http(s)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from needle.