Skip to content
Open
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
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,13 @@ To stay updated with the latest features and product add-ons, visit [Changelog](

[<img height="70" width="220" src="https://user-images.githubusercontent.com/70570645/171866795-52c11b49-0728-4229-b073-4b704209ddde.png">](https://accounts.lambdatest.com/register)


## Validate Custom Headers

Custom headers are essential when making API requests to include metadata such as authentication tokens, tracking information, or custom identifiers. This test ensures that custom headers are correctly sent and received using Cypress.

The test sends a GET request to `https://httpbin.org/headers` with a custom header (`x-custom-header`). It then validates that the server receives the correct header in the response.


## We are here to help you :headphones:

* Got a query? we are available 24x7 to help. [Contact Us]([email protected])
Expand Down
15 changes: 15 additions & 0 deletions cypress/integration/examples/custom-header.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Validate Custom Headers', () => {
it('Should send and validate custom headers', () => {
cy.request({
method: 'GET',
url: 'https://httpbin.org/headers', // Public API to test headers
headers: {
'x-custom-header': 'test-valueee' // Custom header
}
}).then((response) => {
// Validate that the response contains the custom header
expect(response.status).to.eq(200);
expect(response.body.headers['X-Custom-Header']).to.equal('test-value');
});
});
});