Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#951·retrofit

Allow specifying default @Field values.

Author: FolydCreated Jul 9, 2015Updated Jul 16, 2026

As we know,we can use @Field annotation to specify a field in a @POST method, like this:

java
    @POST
    void doSomething(@Field String params,@Field String anotherParams)

I need specify a default value to a field in a POST request,but i have no idea how to do it.

Does Retrofit support specify a default field for POST request? If not,cloud you add a feature to support this?

java
    @POST
    @DefaultField(params = "defaultValue")
    void doSomething(@Field String anotherParams)

Any comment is welcome.Thanks.:)

Source: lysine-dev/retrofit

View original on GitHubView discussion on GitHub