Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

[HttpServer] Capturing body content #137

@avanderhoorn

Description

@avanderhoorn

Body data can only be ready once, hence when we go to read it we will need to wrap the body stream that already exists. This means that from that point onwards, if anyone interacts with the body stream they will be using our copy (the Req/Res objects have a setter for the Body so this should be fine.

Next we need to attempt to read the stream to completion or till we have hit our trim limit (62k - this is a limit that we define so that we don't end up reading 100's mbs). With what ever data we read, we return as part of our payload, but we also need to keep a Memory Stream copy of it so that when someone else attempts to read the Body later we can given them that copy. Only slight trick is that if we only partially read the result previously, we will need to drain our Memory Stream copy first before switching back to the original Body stream.

Note, we also need to be content type/encoding aware as there isn't any point trimming binary content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions