[MGNLRESTCL-157] Request body content-type should be explicitly defined in RestCall definition. Created: 21/Apr/20  Updated: 28/Jun/22

Status: Open
Project: REST Client
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Quach Hao Thien Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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)
Epic Link: RestClient Maintenance

 Description   

As a RestClient consumer, I want to define the content-type of request body explicitly in yaml definition to make it more descriptive instead using header's content-type.

Acceptance criteria

  • If the RestCall contain body, content-type is required.
  • If content-type is missing should log warning and fail to invoke instead of using a default one
  • The content-type of body is equivalent to request header content-type, but if both were defined in restCall, the body content-type should override the header content-type, and/or log warning

Current

baseUrl: http://localhost:${wiremockPort}
restCalls:
  createNewArticle:
    method: POST
    entityClass: java.lang.String
    responseContentType: application/json
    path: /createNew
    body: {content}
    headers:
      Content-Type: multipart/form-data 

If request header content-type is missing, the "application/json" content-type is set by default on backend

Expect 

baseUrl: http://localhost:${wiremockPort}
restCalls:
  createNewArticle:
    method: POST
    entityClass: java.lang.String
    responseContentType: application/json
    path: /createNew
    body:
      content: {content}
      contentType: multipart/form-data
    headers:
      Content-Type: application/json << this will be overridden by body contentType 

 

 


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