Junior — Middle
What types of headers have you used in your projects?
sobes.tech AI
Answer from AI
In QA and test automation projects, the following types of headers are often used:
- HTTP headers — for configuring requests and responses, e.g.,
Content-Type,Authorization,Accept. - Authentication headers — for example,
Bearer TokeninAuthorizationfor API access. - Custom headers — specific to the project, e.g.,
X-Request-IDfor request tracing. - Caching headers —
Cache-Control,ETagfor cache management.
Example of using HTTP headers in an automated test in Python with requests:
import requests
headers = {
'Authorization': 'Bearer your_token',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.get('https://api.example.com/data', headers=headers)
print(response.status_code)