To receive a status code of 204 instead of 200 using Auth0 and Supertest, you can modify your test case to include an assertion that checks for the status code. Here's an example:
const request = require('supertest');
const app = require('../app');
describe('GET /users', () => {
it('returns a 204 status code', (done) => {
request(app)
.get('/users')
.set('Authorization', 'Bearer YOUR_AUTH0_ACCESS_TOKEN')
.expect(204)
.end((err, res) => {
if (err) return done(err);
done();
});
});
});
In this example, we're sending a GET request to the /users endpoint with an Auth0 access token. We're also expecting a status code of 204 in the response. If the status code is not 204, Supertest will throw an error and the test will fail.
Make sure to replace YOURAUTH0ACCESS_TOKEN with an actual access token from your Auth0 application.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-10 11:00:00 +0000
Seen: 9 times
Last updated: Jun 15 '22
How can you distinguish between status replies and explicit mentions in the Twitter API?
How can I conceal records from the datagrid that have an "active" status in the workflow?
The Release status on Google Play console is indicating that it is not available for users.
How can you switch the status of "USE PRINTER OFFLINE" through the command prompt?
What is the process for creating a list of modified components using git?
What does it mean when the status code is 200, but the outcome value is empty?
What is the purpose of the Automated Order Status Module PS 1.7?