A
A
anya_hacker2021-05-21 02:05:41
Java
anya_hacker, 2021-05-21 02:05:41

How to fix Non-body HTTP method cannot contain @Body?

When trying to change data in the database, an error occurs: Interface code:
Non-body HTTP method cannot contain @Body.

@GET("/update")
    public Call<Boolean> update(@Body UsersUpdate urs);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergey, 2021-05-21
@anya_hacker

the thing is GET- requests don't have pages
- replace the method annotation
with @Post("/update")or@Put("/update")

B
BorLaze, 2021-05-21
@BorLaze

It is customary to map CRUD operations like this:
create - POST
read - GET
update - PUT
delete - DELETE
The solution to your question is obvious :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question