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

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).

Activity

  1. WonderCsabo commented on Jun 2, 2015

    @WonderCsabo
    MemberAuthor

    @yDelouis @dodgex thoughts?

  2. changed the title [-]Read from/multipart parameters from method parameters[/-] [+]Add form / multipart parameters from method parameters[/+] on Jun 2, 2015
  3. dodgex commented on Jun 2, 2015

    @dodgex
    Member

    while i switched to Retrofit long time ago, i still think that this might be nice to have for those using AA/RestTemplate. :)

  4. yDelouis commented on Jun 2, 2015

    @yDelouis
    Contributor

    Why not.

  5. WonderCsabo commented on Jun 2, 2015

    @WonderCsabo
    MemberAuthor

    Great!

    @dodgex if you are missing functionality from our REST client, feel free to open feature requests/contribute.

  6. dodgex commented on Jun 2, 2015

    @dodgex
    Member

    @WonderCsabo the only feature i miss is the Retrofit support. ;) I had some problems with RestTemplate that pushed me to to the switch.

  7. self-assigned this
    on Jun 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions