schemathesis: [BUG] Generating invalid HTTP headers
Describe the bug Schemathesis generates headers like:
x-api-key: \x80
The \x80
character is not a part of ISO-8859-1 (AKA Latin-1). This is an issue because according to the HTTP 1.1 standard, all HTTP headers are encoded with ISO-8859-1. This means that my tests will always fail because of something I can’t actually control.
To Reproduce
- In your OpenAPI Schema, add a security schema:
securitySchemes: ApiKey: type: apiKey in: header name: x-custom-api-key-header security: - ApiKey: []
- Run Schemathesis
Expected behavior
I expect Schemathesis to not generate things that are unsupported due to the HTTP spec. By definition, these things will not have stable behaviour, so it’ll be impossible to test with Schemathesis.
Environment (please complete the following information):
- OS: Windows 10
- Python version: 3.9.2
- Schemathesis version: 3.6.3
- Spec version: Open API 3.0.3
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (12 by maintainers)
Commits related to this issue
- fix: Generation of invalid headers in some cases Ref: #1142 — committed to schemathesis/schemathesis by Stranger6667 3 years ago
- fix: Generation of invalid headers in some cases Ref: #1142 — committed to schemathesis/schemathesis by Stranger6667 3 years ago
- fix: Generation of invalid headers in some cases Ref: #1142 — committed to schemathesis/schemathesis by Stranger6667 3 years ago
- feat: A way to control what characters are used for string generation Ref: #1142, #1286, #1562, #1668 — committed to schemathesis/schemathesis by Stranger6667 7 months ago
- feat: A way to control what characters are used for string generation Ref: #1142, #1286, #1562, #1668 — committed to schemathesis/schemathesis by Stranger6667 7 months ago
- feat: A way to control what characters are used for string generation Ref: #1142, #1286, #1562, #1668 — committed to schemathesis/schemathesis by Stranger6667 7 months ago
FYI, the fix for the recent issue is released in 3.11
@hoog1511
Thank you, it confirms, that the root cause is this commit. It should be relatively easy to fix, I’ll work on this today/tomorrow
Cool! Thank you for the detailed report! 😃
I will take a look today