Search in sources :

Example 6 with QueryName

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

the class RequestBuilderTest method queryNameParamOptionalOmitsQuery.

@Test
public void queryNameParamOptionalOmitsQuery() {
    class Example {

        //
        @GET("/foo/bar/")
        Call<ResponseBody> method(@QueryName String ping) {
            return null;
        }
    }
    Request request = buildRequest(Example.class, new Object[] { null });
    assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
}
Also used : Request(okhttp3.Request) QueryName(retrofit2.http.QueryName) ResponseBody(okhttp3.ResponseBody) Test(org.junit.Test)

Aggregations

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