etr/libhttpserver

[Question] Change headers of a deferred_response

azertyalex opened this issue · 1 comments

I am implementing a deferred_response. After reading the docs @ https://github.com/etr/libhttpserver/blob/master/README.md?plain=1#L632

It looks to me that I can not change headers or content-type after my deferred_response has been returned in the render function, I modify the object but I see no changes. It looks like a need more of a promise instead of a deferred response?

Is it in any way possible to set headers after render has been returned?

etr commented

This is as intended and it is an effect of the protocol (HTTP-1.1) not of the library. If you have already given the answer to your client, they've already received the headers. All you are doing with a deferred response is saying to them "I have more content here" but none of this content can override what you've already given to them (included the headers).

I hope this helps, but if you want to and can describe your use-case, I can see if there is a workaround in a way that is compatible with the protocol.