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

HttpService - Delete method does not include data - even if it's included in data config. #5569

Closed
iteratelance opened this issue Oct 13, 2020 · 5 comments
Labels
needs triage This issue has not been looked into

Comments

@iteratelance
Copy link

iteratelance commented Oct 13, 2020

Bug Report

Current behavior

When making delete request the data is not added to the request.

Input Code

Please note that config is the second argument for delete request per axios documentation.
axios/axios#897 - this is not the cause of this bug. I think it has something to do with http.service.js makeObservable

const res = await this.httpService.delete<any>('/url', {data: body, headers: {}}).toPromise();

Expected behavior

Should append data to the request body.

Workaround

    const config = {
      url: '/url',
      method: 'delete' as Method,
      headers: {}
      data: {some_payload: {}}
    };
const res = await this.httpService.request<any>(config).toPromise();

Environment


Nest version: 7.4.4
 
@iteratelance iteratelance added the needs triage This issue has not been looked into label Oct 13, 2020
@jmcdo29
Copy link
Member

jmcdo29 commented Oct 13, 2020

Please provide a minimum reproduction repository.

@constb
Copy link

constb commented Oct 14, 2020

@iteratelance

AFAIK, this should be like that:

const res = await this.httpService.delete<any>('/url', body, {headers: {}}).toPromise();

@nrayburn-tech
Copy link

I think that this is related to an issue with Axios.

I am not sure what version of Axios that nest uses, but here is a related issue from the Axios repo, axios/axios#3220.
This axios/axios#3282 fixes that issue, and is expected to be in the next release.

@iteratelance
Copy link
Author

iteratelance commented Oct 20, 2020

@iteratelance

AFAIK, this should be like that:

const res = await this.httpService.delete<any>('/url', body, {headers: {}}).toPromise();

@constb thanks for the reply. I tried that format as well. According to the docs for axios body is not accepted as an argument for delete and must be passed as a config value. axios/axios#897

Really appreciate the support from you all.

@jasonsaayman
Copy link

Hi,

Version 0.21.0 has been released 🎉 please use that and let us know if that solves your issue.

Thanks

leeklife pushed a commit to leeklife/nest that referenced this issue Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

6 participants