Skip to content

Suggestion: use different keys for request and response headers #16

@hannes-petri-maxiv-lu-se

Description

Currently, both headers supplied to a request and headers received from the response are found under the same key headers in the msg object. This can easily give rise to hard-to-find bugs in the following situation:

… --> [set headers] --> [request 1] --> [request 2] --> …

First, headers are set (msg.headers = {…}). Then, after request 1, msg.headers now contains the response headers of request 1. When request 2 is made, these are supplied as request headers. You need to clear the headers between the requests:

… --> [set headers] --> [request 1] --> {msg.headers = {}} --> [request 2] --> …

I guess this is useful when piping the output of one request directly into another, since the content-type, content-length etc headers will be appropriately set automatically. Still, it's easily overlooked and the result can be very unexpected.

Suggestion:

Maybe the headers could be stored under different keys, such as msg.requestHeaders and msg.responseHeaders? Then requestHeaders can be cleared automatically by each request since they aren't needed anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions