I'm trying to handle Expect headers and I'm unsure if it's possible with httpure:
An origin server MUST, upon receiving an HTTP/1.1 (or later)
request-line and a complete header section that contains a
100-continue expectation and indicates a request message body will
follow, either send an immediate response with a final status code,
if that status can be determined by examining just the request-line
and header fields, or send an immediate 100 (Continue) response to
encourage the client to send the request's message body. The origin
server MUST NOT wait for the message body before sending the 100
(Continue) response.
It seems that since there's no listener on 'checkContinue' (purescript-node-http doesn't expose or handle the event and it doesn't look like anything is happening in this package), the underlying http module will always respond with 100 Continue and process the request. Is that right?
If so, can we add something to allow us to decide whether or not to respond with 100 Continue or some other code based on the request headers alone? E.g. if a client sends:
> POST /foo HTTP/1.1
> Content-Type: application/json
> Expect: 100-continue
And we know we cannot handle JSON, how do we respond with a 415 Unsupported Media Type? Or if a client sends:
> POST /foo HTTP/1.1
> Content-Length: 123456789012345
> Expect: 100-continue
And we know we're not going to handle giant requests, how would we respond with 413 Payload Too Large?
If we can add something that allows handling Expect: 100-continue, how would we send the 100 Continue line without closing the connection but reading the request? The model of httpure seems to be that you already have an HTTPure.Request.Request (with a body), and that you're working with that. Is there another way to handle things?
I'm trying to handle
Expectheaders and I'm unsure if it's possible withhttpure:It seems that since there's no listener on
'checkContinue'(purescript-node-httpdoesn't expose or handle the event and it doesn't look like anything is happening in this package), the underlyinghttpmodule will always respond with100 Continueand process the request. Is that right?If so, can we add something to allow us to decide whether or not to respond with
100 Continueor some other code based on the request headers alone? E.g. if a client sends:And we know we cannot handle JSON, how do we respond with a
415 Unsupported Media Type? Or if a client sends:And we know we're not going to handle giant requests, how would we respond with
413 Payload Too Large?If we can add something that allows handling
Expect: 100-continue, how would we send the100 Continueline without closing the connection but reading the request? The model ofhttpureseems to be that you already have anHTTPure.Request.Request(with a body), and that you're working with that. Is there another way to handle things?