solarium icon indicating copy to clipboard operation
solarium copied to clipboard

RequestBuilders are responsible for setting the Content-Type

Open thomascorthals opened this issue 3 years ago • 1 comments

If we want to support JSON updates alongside XML updates, it no longer makes sense to have the Adapters set a default Content-Type for POSTs. There were already a number of RequestBuilders that set it explicitly to another value anyway. And GETs don't really need a Content-Type. I've made the RequestBuilders responsible to always set it if necessary. They can now set it with Request::setContentType() (as was already the case for API Requests).

None of the integration tests or examples had to be changed. It should be fully backward compatible except for users who wrote custom RequestBuilders.

thomascorthals avatar Aug 08 '22 12:08 thomascorthals

Codecov Report

Merging #1030 (7242bc3) into master (090a4a5) will increase coverage by 0.14%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1030      +/-   ##
==========================================
+ Coverage   97.05%   97.20%   +0.14%     
==========================================
  Files         358      359       +1     
  Lines        8772     8823      +51     
==========================================
+ Hits         8514     8576      +62     
+ Misses        258      247      -11     
Flag Coverage Δ
unittests 97.20% <100.00%> (+0.14%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/QueryType/Server/Query/AbstractResult.php 50.00% <ø> (ø)
src/Component/RequestBuilder/Analytics.php 100.00% <100.00%> (ø)
src/Core/Client/Adapter/AdapterHelper.php 100.00% <100.00%> (+11.76%) :arrow_up:
...ore/Client/Adapter/ConnectionTimeoutAwareTrait.php 100.00% <100.00%> (ø)
src/Core/Client/Adapter/Curl.php 97.64% <100.00%> (+1.35%) :arrow_up:
src/Core/Client/Adapter/Http.php 100.00% <100.00%> (ø)
src/Core/Client/Adapter/ProxyAwareTrait.php 100.00% <100.00%> (ø)
src/Core/Client/Adapter/Psr18Adapter.php 100.00% <100.00%> (ø)
src/Core/Client/Adapter/TimeoutAwareTrait.php 100.00% <100.00%> (ø)
src/Core/Client/Request.php 100.00% <100.00%> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 08 '22 13:08 codecov[bot]