Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter marked with @Body in Retrofit methods fully replace other parameters marked with @Field. #670

Open
Ridje opened this issue Apr 30, 2024 · 0 comments

Comments

@Ridje
Copy link

Ridje commented Apr 30, 2024

Hello there.

Description
I have a situation where I need to use both @Body and @field together. However, in my specific case, parameters marked with @field are not used in the generated file. Am I doing something wrong ideologically, or should I use another approach?

Code

  @POST('%{someexample}')
  @FormUrlEncoded()
  Future<String> getMyEndpoint({
    @Field("SERVICE_CODE") required String serviceCode,
    @Body() required Map<String, String> parameters,
    @Field("ACTION") String action = "ONLINE_CHECK",
  });

Expected request body
Data: {
"SERVICE_CODE: "myCode",
"ACTION": "ONLINE_CHECK",
"BODY_PARAM_1": "123",
"BODY_PARAM_2": "321",
}

Actual request body
Data: {
"BODY_PARAM_1": "123",
"BODY_PARAM_2": "321",
}

@Ridje Ridje changed the title @Body in params override @Field Parameter marked with @Body in Retrofit methods fully replace other parameters marked with @Field. Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant