http icon indicating copy to clipboard operation
http copied to clipboard

Configure headers in response setup

Open mabar opened this issue 6 years ago • 8 comments

  • BC break: no
  • doc PR: not needed

Moved headers configuration from initialize() method of DIC to Response service setup. Useful for applications with multiple http layer implementations (we use psr-7 in Apitte). It should prevent mixing headers from nette/http if not used for current request

mabar avatar Mar 17 '19 13:03 mabar

I am not sure how to fix tests. I tested it in my app and it should work properly.

mabar avatar Mar 18 '19 08:03 mabar

@dg Ready

mabar avatar Jul 06 '19 14:07 mabar

I'm afraid this is a BC break, which is not suitable for the patch version.

dg avatar Jul 07 '19 14:07 dg

I thinked about it too. It should be BC break only in case that someone depends on fact that headers are sent and Response is not instantiated by user's app.

nette\application users are ok, only users of standalone nette/http should be affected and just in case they send response incorrectly without Response class.

As far as I know, Apitte is the only http-related nette extension, which is (almost) completely separated from nette/http and it will be not affected by this change until next version.

Do you know an other case which could be problematic? This PR is non-blocking for me, so it could wait. Just an architectural problem.

mabar avatar Jul 07 '19 14:07 mabar

Maybe a compatibility-mode, which would be enabled by default? It would just initialize service in initialize() method, if enabled.

Something like this

mabar avatar Jul 07 '19 14:07 mabar

In case it is non-blocking for you, I will postpone it to 3.1.

dg avatar Jul 07 '19 14:07 dg

ok, thanks

mabar avatar Jul 07 '19 14:07 mabar

@dg Would this change be acceptable for v4.0? Response will not sent headers directly anyway and it would be helpful if it didn't interfere with other http libraries.

mabar avatar May 19 '21 10:05 mabar