Search in sources :

Example 6 with Field

use of retrofit2.http.Field in project retrofit by square.

the class RequestBuilderTest method formEncodedWithEncodedNameFieldParam.

@Test
public void formEncodedWithEncodedNameFieldParam() {
    class Example {

        //
        @FormUrlEncoded
        //
        @POST("/foo")
        Call<ResponseBody> method(@Field(value = "na%20me", encoded = true) String foo) {
            return null;
        }
    }
    Request request = buildRequest(Example.class, "ba%20r");
    assertBody(request.body(), "na%20me=ba%20r");
}
Also used : Field(retrofit2.http.Field) Request(okhttp3.Request) ResponseBody(okhttp3.ResponseBody) Test(org.junit.Test)

Aggregations

Request (okhttp3.Request)6 ResponseBody (okhttp3.ResponseBody)6 Test (org.junit.Test)6 Field (retrofit2.http.Field)6 List (java.util.List)1