Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Could $resource delete send a data in body be possible? #15174

Closed
ifbbprochris opened this issue Sep 22, 2016 · 4 comments
Closed

Could $resource delete send a data in body be possible? #15174

ifbbprochris opened this issue Sep 22, 2016 · 4 comments

Comments

@ifbbprochris
Copy link

Note: for support questions, please use one of these channels: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.

Do you want to request a feature or report a bug?
feature

What is the current behavior?
$resource delete doesn't support to send a body

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

What is the expected behavior?
Is it possible to config the $httpProvider.defaults.headers.delete to make it possible to send a request with a body?

If it is possible,and how?

thanks

What is the motivation / use case for changing the behavior?
Because many backend guys don't follow the RESTfull standard,and they want to change their API design.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

Other information (e.g. stacktraces, related issues, suggestions how to fix)

@gkalpak
Copy link
Member

gkalpak commented Sep 22, 2016

It is currently not possible. Closing as duplicate of #8567.

@gkalpak gkalpak closed this as completed Sep 22, 2016
@gkalpak
Copy link
Member

gkalpak commented Sep 22, 2016

This has also been discussed in #3207. There are more details on what is/isn't possible there (e.g. starting at #3207 (comment)).

@ifbbprochris
Copy link
Author

@gkalpak thanks
another question
this is a service
test
this is a middleware
test-1

if I call the tagHandler.saveDeviceMapByTag function ,the request url will be like be this
https://localhost:8080/api/v1/tag/device/map?tag_id=4,
and the request body is {tag_id: 4, group_id: 1}
I dont want the params add to url, I want to send a request url like https://localhost:8080/api/v1/tag/device/map

How could I do?

@gkalpak
Copy link
Member

gkalpak commented Sep 25, 2016

@ChrisFuck, you specify the default params as {tad_id: '@tag_id'}. This means that there will be a param named tag_id whose value will be the value of the instance's tag_id property (here 4). Since there is no param named tag_id in the URL, as happens with the extra params, it will be appended as a query param.

I am not sure what you are trying to achieve with {tag_id: '@tag_id'}, so I can't suggest a solution.

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

No branches or pull requests

2 participants