Skip to content

How to set request method dynamically? #272

@amesinp

Description

@amesinp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions