Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Add form / multipart parameters from method parameters #1438

@WonderCsabo

Description

@WonderCsabo

In Retrofit we can do sg like this:

@FormUrlEncoded
@POST("/user/edit")
User updateUser(@Field("first_name") String first, @Field("last_name") String last);

restClient.updateUser("Csaba", "Kozák");

However in AA, we have to do this:

@Post("/user/edit")
User updateUser(MultiValueMap<String, String> formData);

MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("first_name", "Csaba");
formData.add("last_name", "Kozák");
restClient.updateUser(formData);

It would be nice to add the @Field annotation to AA. Actually it can be used for form-urlencoded and multipart requests, too, since both are handled the same way in FormHttpMessageConverter (added to the map).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions