-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for the
--header
option
- Loading branch information
1 parent
08ef727
commit ab29198
Showing
8 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
GET http://localhost:8000/add-header | ||
HTTP 200 | ||
|
||
GET http://localhost:8000/add-header-with-aggregation | ||
header-a: foo | ||
HTTP 200 | ||
|
||
GET http://localhost:8000/add-header-with-duplicate | ||
header-b: bar | ||
{"message":"hi!"} | ||
HTTP 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Set-StrictMode -Version latest | ||
$ErrorActionPreference = 'Stop' | ||
|
||
hurl --header 'header-b:baz' --header 'header-c:qux' tests_ok/add_header.hurl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from app import app | ||
from flask import request | ||
|
||
|
||
@app.route("/add-header") | ||
def add_header(): | ||
assert request.headers.get("header-b") == "baz" | ||
assert request.headers.get("header-c") == "qux" | ||
return "" | ||
|
||
|
||
@app.route("/add-header-with-aggregation") | ||
def add_header_with_aggregation(): | ||
assert request.headers.get("header-a") == "foo" | ||
assert request.headers.get("header-b") == "baz" | ||
assert request.headers.get("header-c") == "qux" | ||
return "" | ||
|
||
|
||
@app.route("/add-header-with-duplicate") | ||
def add_header_with_duplicate(): | ||
assert request.headers.get("header-b") == "bar,baz" | ||
assert request.headers.get("header-c") == "qux" | ||
assert request.get_json()["message"] == "hi!" | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -Eeuo pipefail | ||
|
||
hurl --header 'header-b:baz' --header 'header-c:qux' tests_ok/add_header.hurl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GET http://localhost:8000/override-header | ||
HTTP 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Set-StrictMode -Version latest | ||
$ErrorActionPreference = 'Stop' | ||
|
||
hurl --header 'User-Agent: different-user-agent' --header 'Accept: different-accept' --header 'Host: different-host' tests_ok/override_header.hurl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from app import app | ||
from flask import request | ||
|
||
|
||
@app.route("/override-header") | ||
def override_user_agent(): | ||
assert request.headers.get("User-Agent") == "different-user-agent" | ||
assert request.headers.get("Accept") == "different-accept" | ||
assert request.headers.get("Host") == "different-host" | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -Eeuo pipefail | ||
|
||
hurl --header 'User-Agent: different-user-agent' --header 'Accept: different-accept' --header 'Host: different-host' tests_ok/override_header.hurl |