Uploaded image for project: 'REST Client'
  1. REST Client
  2. MGNLRESTCL-157

Request body content-type should be explicitly defined in RestCall definition.

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • API
    • None

      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 

       

       

        Acceptance criteria

              Unassigned Unassigned
              thien.quach Quach Hao Thien
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:

                  Task DoD