Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set request method dynamically? #272

Open
amesinp opened this issue Jun 29, 2020 · 1 comment
Open

How to set request method dynamically? #272

amesinp opened this issue Jun 29, 2020 · 1 comment

Comments

@amesinp
Copy link

amesinp commented Jun 29, 2020

I am currently achieving this by initializing the request then modifying the method before sending. Something like this:

const request = chai.request(app)
  .get(url)
  .set('Authorization', bearerToken);
request.method = newMethod;

const response = await request.send(data);

I am wondering if there is a better way to go about this.

Thank you

@usama8800
Copy link

Can't we do chai.request(app)[newMethod](url).send(data)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants