Loredra L
Loredra L

Reputation: 1553

Specify the type of parameter for DELETE request in Nodejs

I would like to do a DELETE request with unspecified number of parameters a=someValue. There is 2 main ways of supplying parameters to my understanding

  1. Query parameters. ?a=someValue . This approach turn everything into string and since I allow any number of parameters, I cannot know which one is String, Boolean or Integer

  2. Parameters in Body.This approach goes against the spec of DELETE operation to not have a body. Some server even strip away the body-content. But as I send an json object, user can specify which type of value each of their parameters has.

What would be your approach for this?

Upvotes: 0

Views: 415

Answers (1)

GreatDharmatma
GreatDharmatma

Reputation: 667

I'd use query parameters over body as the DELETE method has an optional body. Some clients may choose to ignore the body totally.

Upvotes: 1

Related Questions