diff --git a/README.md b/README.md index 3f79e90..34fdc77 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,13 @@ To stay updated with the latest features and product add-ons, visit [Changelog]( [](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](support@lambdatest.com) diff --git a/cypress/integration/examples/custom-header.spec.js b/cypress/integration/examples/custom-header.spec.js new file mode 100644 index 0000000..85a6d7f --- /dev/null +++ b/cypress/integration/examples/custom-header.spec.js @@ -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'); + }); + }); +});