Skip to content

Commit

Permalink
Merge pull request postmanlabs#480 from javabrett/476-fix-redirect-to
Browse files Browse the repository at this point in the history
Added url and status_code as query-string parameters for SwaggerUI
  • Loading branch information
kennethreitz authored Jul 4, 2018
2 parents 8027ee9 + dd2513a commit 371dc24
Showing 1 changed file with 47 additions and 6 deletions.
53 changes: 47 additions & 6 deletions httpbin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,58 @@ def redirect_to():
- Redirects
produces:
- text/html
parameters:
- name: url
type: string
- name: status_code
type: int
get:
parameters:
- in: query
name: url
type: string
required: true
- in: query
name: status_code
type: int
post:
consumes:
- application/x-www-form-urlencoded
parameters:
- in: formData
name: url
type: string
required: true
- in: formData
name: status_code
type: int
required: false
patch:
consumes:
- application/x-www-form-urlencoded
parameters:
- in: formData
name: url
type: string
required: true
- in: formData
name: status_code
type: int
required: false
put:
consumes:
- application/x-www-form-urlencoded
parameters:
- in: formData
name: url
type: string
required: true
- in: formData
name: status_code
type: int
required: false
responses:
302:
description: A redirection.
"""

args = CaseInsensitiveDict(request.args.items())
argsDict = request.form.to_dict(flat=True) if request.method in ('POST', 'PATCH', 'PUT') else request.args.items()
args = CaseInsensitiveDict(argsDict)

# We need to build the response manually and convert to UTF-8 to prevent
# werkzeug from "fixing" the URL. This endpoint should set the Location
Expand Down

0 comments on commit 371dc24

Please sign in to comment.