[MGNLRESTCL-100] Cannot render some HTTP response codes Created: 22/Nov/19 Updated: 16/Apr/20 Resolved: 27/Nov/19 |
|
| Status: | Closed |
| Project: | REST Client |
| Component/s: | None |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Martin Drápela | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 4.5h | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Epic Link: | Declarative REST clients | ||||||||||||||||
| Sprint: | Declarative REST 11 | ||||||||||||||||
| Story Points: | 2 | ||||||||||||||||
| Description |
|
We should make sure that if we get an HTTP response code in a response and if our primary goal is knowing what the Status or StatusInfo is, we should be able to display that (https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html). Two examples (Common client config) baseUrl: 'http://httpbin.org/'
class: 'info.magnolia.rest.client.ConfiguredRestClientDefinition'
clientFactoryClass: 'info.magnolia.rest.client.factory.DefaultClientFactory'
restCalls:
requestCode:
method: 'GET'
entityClass: 'java.lang.String'
path: 'status/{code}'
defaultValues:
code: 404
requestJson:
method: 'GET'
entityClass: 'com.fasterxml.jackson.databind.JsonNode'
path: 'json'
[#assign code204Call = restfn.call("errors", "requestCode", {"code": 204})]
<p>
<b>code204Call:</b> ${code204Call.getEntity()?has_content?then(code204Call.getEntity(), code204Call.getStatus())}
</p>
Requesting 204 via curl you get "204 NO CONTENT" martin@ryzen5 ~ $ curl -I http://httpbin.org/status/204? HTTP/1.1 204 NO CONTENT Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Content-Type: text/html; charset=utf-8 Date: Fri, 22 Nov 2019 11:48:25 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Connection: keep-alive Magnolia displays "200" instead:
Example: Code 205 - Reset Content [#assign code205Call = restfn.call("errors", "requestCode", {"code": 205})]
<p>
<b>code205Call:</b> ${code205Call.getEntity()?has_content?then(code205Call.getEntity(), code205Call.getStatus())}
</p>
Requesting 205 via curl you get "205 RESET CONTENT" martin@ryzen5 ~ $ curl -I http://httpbin.org/status/205? HTTP/1.1 205 RESET CONTENT Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Content-Length: 0 Content-Type: text/html; charset=utf-8 Date: Fri, 22 Nov 2019 11:48:29 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Connection: keep-alive Magnolia doesn't show "205", but instead complains about receiving no entity:
|