Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing schema check for redirect query params #928

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tavern/_core/schema/tests.jsonschema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ definitions:
description: Expected JSON response
$ref: "#/definitions/any_json"

redirect_query_params:
description: Query parameters parsed from the 'location' of a redirect
type: object

verify_response_with:
oneOf:
- $ref: "#/definitions/verify_block"
Expand Down
10 changes: 8 additions & 2 deletions tests/integration/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import uuid
from datetime import datetime, timedelta
from hashlib import sha512
from urllib.parse import unquote_plus
from urllib.parse import unquote_plus, urlencode

import jwt
from flask import Flask, Response, jsonify, make_response, redirect, request, session
Expand Down Expand Up @@ -332,7 +332,13 @@ def expect_cookie():

@app.route("/redirect/source", methods=["GET"])
def redirect_to_other_endpoint():
return redirect("/redirect/destination", 302)
query_params = urlencode(
{
"test_value": "lorem ipsum?",
}
)

return redirect(f"/redirect/destination?{query_params}", 302)


@app.route("/redirect/loop", methods=["GET"])
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/test_follow_redirects.tavern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@ stages:
status_code: 200
json:
status: successful redirect

---
test_name: Checking for redirect_query_params

stages:
- name: Check for a complex value in redirect query params
request:
url: "{global_host}/redirect/source"
response:
status_code: 302
redirect_query_params:
test_value: lorem ipsum?
Loading