Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Created August 27, 2015 18:57
Show Gist options
  • Save dwelch2344/44aae8650042401c57a7 to your computer and use it in GitHub Desktop.
Save dwelch2344/44aae8650042401c57a7 to your computer and use it in GitHub Desktop.
@FeignClient(url = "${app.api.someService.baseUrl}")
public interface SomeFeign {
@RequestMapping(method = RequestMethod.POST, value = "/steps/",
produces = "application/json")
Step createStep(@RequestBody Step step);
@RequestMapping(method = RequestMethod.PUT, value = "/steps/{stepId}",
produces = "application/json")
Step updateStep(@RequestBody Step step, @PathVariable("stepId") Long stepId);
}
@dwelch2344
Copy link
Author

Running into an issue where feign always posts the data with content-type application/x-www-form-urlencoded;charset=UTF-8, even though I specify application/json. Is there some other config needed / annotation to use?

@spencergibb
Copy link

I'm not sure. @RequestBody isn't needed.

@spencergibb
Copy link

Do you have a project you can share?

@dwelch2344
Copy link
Author

@spencergibb Unfortunately not. I was working on pulling it out to a POC when I took a last ditch shot at changing produces = "application/json" to produces = "application/json", consumes = "application/json" and it started playing nicely...

Any ideas why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment