[MGNLRESTCL-123] Support API's without Content-type Created: 23/Dec/19  Updated: 03/Jun/20  Resolved: 22/Apr/20

Status: Closed
Project: REST Client
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.1

Type: Improvement Priority: Neutral
Reporter: Jorge Franco Assignee: Quach Hao Thien
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0.25d
Time Spent: 1d 3h
Original Estimate: Not Specified

Issue Links:
causality
is causing MGNLRESTCL-159 DOC: Option to specify the content-ty... Closed
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)
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Declarative REST clients
Sprint: 6.2.1 Ramp-up 22
Story Points: 1

 Description   

Re-evaluation; timeboxed to 1 SP.

Some api's not return content-type in the response, and actually response is empty. To support that we will do the following:

 

  • Show a warning (log) the when api's not returning a content-type.
  • Allow the user specify the content-type in the rest client definition.
  • Add a filter that add the specified content-type to the response.


 Comments   
Comment by Christopher Zimmermann [ 07/Jan/20 ]

What are some examples - or one example of an API like this?

Comment by Jorge Franco [ 07/Jan/20 ]

Yeah, it happens for example with this API - http://openlibrary.org/search.json?title=paranoiax czimmermann

Comment by Chris Jennings [ 20/Feb/20 ]

Can either of you please elaborate on adding a content-type header via a filter?

Raw content from Github comes with a text/plain content-type header even when it is actually parse-able JSON.

eg. https://raw.githubusercontent.com/oobrien/vis/master/tube/data/tfl_stations.json

Calling this URL with a Mgnl REST client results in the error "RESTEASY003145: Unable to find a MessageBodyReader of content-type text/plain;charset=utf-8 and type class com.fasterxml.jackson.databind.JsonNode
Content not available. Please try again later. If this problem persists contact your system administrator."

As a workaround, I can use various proxies [1] but this adds a dependency. A filter example would be very useful.

1: https://rawcdn.githack.com/oobrien/vis/c1476d6d2baa4cbbf12079e8f25ee32ef798d9b2/tube/data/tfl_stations.json

Comment by Quach Hao Thien [ 13/Apr/20 ]

Hi jfranco and chris.jennings,

I tried both examples above without any error, this problem has been fixed before release rest-client-2.0

 

Generated at Mon Feb 12 10:43:26 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.