Uploaded image for project: 'edge-rtac'
  1. edge-rtac
  2. EDGRTAC-16

Honor the Accept header

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed (View Workflow)
    • Priority: P2
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2.1.0
    • Labels:
      None
    • Template:
    • Sprint:
      Core: F - Sprint 101, Core: F - Sprint 102, Core: F - Sprint 103, Prokopovych - Sprint 104
    • Story Points:
      3
    • Development Team:
      Prokopovych

      Description

      Overview

      Currently the edge rtac API always returns XML. Honoring the accept header for at least application/json will make it easier for external systems to consume this service.

      Really, this means that if the accept header is request application/json, we just return the json response obtained from mod-rtac, instead of converting it to XML.
      Any other value specified in the accept header would result in XML, including if the accept header is omitted altogether.
      Summarizing:

      • If accept header equals '*/*' or 'application/xml' or isn't specified, then response returns xml
      • If accept header equals 'application/json', then response returns json
      • Inappropriate accept headers (such as image/* or even application/*) should result in HTTP 406 Unacceptable status

      Acceptance Criteria

      • The service an return either xml or json based upon the request's accept header
      • HTTP 406 error is returned in case of inappropriate accept headers specified in request
      • Unit tests are updated
      • API tests are updated.

      Scenarios

      1. Scenario – return XML
      • Given request to edge-rtac
      • When Accept header in request equals / or includes application/xml or is empty
      • Then response is returned in XML format
      2. Scenario – return JSON
      • Given request to edge-rtac
      • When Accept header in request includes application/json
      • And application/xml isn’t included in Accept header
      • Then response is returned in JSON format
      3. Scenario – return HTTP 406 status
      • Given request to edge-rtac
      • When Accept header in request doesn’t include application/json or application/xml
      • And Accept header doesn’t equal '*/*'
      • And Accept header isn’t empty
      • Then return HTTP 406 error status instead of response

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                oyatsenko Oleksandr Yatsenko
                Reporter:
                cmcnally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases