Question: Getting the headers for tests
See original GitHub issueI feel like this is out of topic, though. Anyway –
I’m implementing JWT with Axios, and would like to send the Authorization
Header through the interceptor. Question, how do I test with Sinon that I am able to send the said header? Which do I spy? Thanks.
Edit: I just checked the API, and the headers doesn’t seem to be covered in the interceptors. In the Interceptors example, is config
equal to the whole request
API or just the config
in it?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
php - Getting status code response headers for unit tests
You can use the http_response_code() function to return the values you set: print_r("Response Code: " . http_response_code());. Result: Response Code: 422.
Read more >Using Question Type Headers on Tests - Tamarack Software
TestGen supplies a standard question type headers for each of the six main question types: multiple choice, true/false, short answer, essay, matching, and ......
Read more >Problem with HTTP headers in test - Laracasts
Hi guys, I'm facing a problem with some application tests. I'm using Laravel 5.7. I have a test like this one. Copy Code...
Read more >Understanding REST Headers and Parameters - SoapUI
Headers are mostly classified as request headers and response headers, know the major request and response headers. You will have to set the...
Read more >Testing a custom HTTP response header - Pega
Have a question? Get answers now. Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I should probably also mention, that you don’t have to use an interceptor for modifying headers. You can use a transformer as well.
Or if you want to use the transformer on every request, not just a single request:
This is an example using sinon and jasmine: