dredd: Dredd HTTP client should not follow redirects

Describe your problem

I’m unable to verify one of my API endpoints which produces a 303 redirect to an external service

My endpoint API (swagger) looks like this

  /signed_url:
    get:
      description: |
        Redirect to S3 object download url
      consumes: []
      parameters:
         - name: id
           in: query
           description: the S3 object key
           required: true
           type: string
           x-example: 123
      responses:
        '303':
          description: Redirect response to S3
          headers:
            Location:
              description: The S3 signed url to the requested object
              type: string
              format: uri

I would like Dredd to verify the expectations on my service response, instead it follows the redirect and checks the expectations on the external service response (which of course won’t match my API specification and fails the test). I can’t think of a use case in which following redirects would be a desired behavior, but if so it should be an opt-in setting.

What command line options do you use?

$ dredd api.swagger.yaml "${BASE_URL}" --hookfiles=./test/dredd-hooks/*.js

What is in your dredd.yml?

no dredd.yml

What’s your dredd --version output?

dredd v3.5.0 (Darwin 16.6.0; x64)

Can you send us failing test in a Pull Request?

If you agree on this being a bug I can create a PR with a fix.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Turned this into a feature request 🙂

FYI, responses for POST containing a redirect were not being followed. Only GET responses with redirection. Anyways, I’ve added tests for both cases.