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 send an string array for a HTTP Delete method #1940

Closed
xiaogu-space opened this issue Jul 25, 2016 · 4 comments
Closed

How to send an string array for a HTTP Delete method #1940

xiaogu-space opened this issue Jul 25, 2016 · 4 comments

Comments

@xiaogu-space
Copy link

because it can‘t support body

@JakeWharton
Copy link
Member

you can use @HTTP(method = "DELETE", hasBody = true) for the HTTP method annotation.

@xiaogu-space
Copy link
Author

but I use it like this,and it's error

    @Headers(ANDROIRHEADER)
    @HTTP(method = "DELETE", hasBody = true)
    @DELETE("api/messages")
    Observable<JsonElement> deleteMessage(@Header("token") String token, @Body MessageIds messageRead);

the error like this

java.lang.IllegalArgumentException: Only one HTTP method is allowed. Found: DELETE and DELETE.
for method ApiService.deleteMessage
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:720)
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:711)
at retrofit2.ServiceMethod$Builder.parseHttpMethodAndPath(ServiceMethod.java:280)
at retrofit2.ServiceMethod$Builder.parseMethodAnnotation(ServiceMethod.java:258)
at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:170)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
at retrofit2.Retrofit$1.invoke(Retrofit.java:145)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy0.deleteMessage(Unknown Source)
at com.dituwuyou.adapter.MessageAdapter.deleteSingleMessage(MessageAdapter.java:311)
at com.dituwuyou.adapter.MessageAdapter.removeItem(MessageAdapter.java:363)
at com.dituwuyou.ui.MessageActivity.onClick(MessageActivity.java:150)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

@JakeWharton
Copy link
Member

Remove @delete and put the path on @http

On Mon, Jul 25, 2016, 9:32 PM XiaoGu notifications@github.com wrote:

but I use it like this,and it's error

@Headers(ANDROIRHEADER)
@HTTP(method = "DELETE", hasBody = true)
@DELETE("api/messages")
Observable<JsonElement> deleteMessage(@Header("token") String token, @Body MessageIds messageRead);

the error like this

java.lang.IllegalArgumentException: Only one HTTP method is allowed.
Found: DELETE and DELETE.
for method ApiService.deleteMessage
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:720)
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:711)
at
retrofit2.ServiceMethod$Builder.parseHttpMethodAndPath(ServiceMethod.java:280)
at
retrofit2.ServiceMethod$Builder.parseMethodAnnotation(ServiceMethod.java:258)
at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:170)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
at retrofit2.Retrofit$1.invoke(Retrofit.java:145)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy0.deleteMessage(Unknown Source)
at
com.dituwuyou.adapter.MessageAdapter.deleteSingleMessage(MessageAdapter.java:311)
at com.dituwuyou.adapter.MessageAdapter.removeItem(MessageAdapter.java:363)
at com.dituwuyou.ui.MessageActivity.onClick(MessageActivity.java:150)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
#1940 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEVTLbdwNi1HbKZS1eWss16eTXU-7ks5qZWO_gaJpZM4JT2xk
.

@xiaogu-space
Copy link
Author

OK

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