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

FormEncoder bug #109

Open
redjiang opened this issue May 18, 2022 · 1 comment
Open

FormEncoder bug #109

redjiang opened this issue May 18, 2022 · 1 comment

Comments

@redjiang
Copy link

if (MAP_STRING_WILDCARD.equals(bodyType)) {

if bodyType‘s typeName is "java.util.map<java.lang.String, java.lang.Object>" cannot correct match

eg:
@RequestLine("POST /user")
@headers("Content-Type: application/x-www-form-urlencoded")
void addUser (Map<String,Object> stringObjectMap);

@molsza
Copy link

molsza commented Jul 13, 2022

It also cannot recognize the org.springframework.util.MultiValueMap.

So for example this method will never send a body:

  @PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED)
  ResponseEntity<ObjectNode> requestForSomething(@RequestBody MultiValueMap<String, String> params);

The workaround for this is

  @PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED)
  ResponseEntity<ObjectNode> requestForSomething(@RequestBody Map<String, ? extends Object> params);

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

2 participants