These are chat archives for spring-cloud/spring-cloud

6th
Mar 2017
LIN
@magixsource
Mar 06 2017 06:11
Hello, is anyway disabled auto-discovery in gateway side
i don't want connect registry when i develop in Gateway side.
LIN
@magixsource
Mar 06 2017 06:59
yes, i googled it and i found ribbon.eureka.enabled, but it's not works here, my springcloud version is 1.4.0
dragontree101
@dragontree101
Mar 06 2017 07:03

how can i add post body in zuul? my code is

 Map<String, String[]> params = ctx.getRequest().getParameterMap();
      if(params == null) {
        params = Maps.newHashMap();
      }
      params.put("abc", new String[]{"aaa"});

invalid

my request to zuul is

curl -XPOST '127.0.0.1:8080/zuul-example' -d 'aaa=111'

and i want to in zuul' filter add some request body.

if my request is GET i can use ctx.setRequestQueryParams(params); and i don't know how to set param body in POST request
LIN
@magixsource
Mar 06 2017 07:06
Filter
dragontree101
@dragontree101
Mar 06 2017 07:06
i use filter, but i don't find any method to set POST request body
@dsyer please! thanks
LIN
@magixsource
Mar 06 2017 07:16
i can't found method to set request body here http://netflix.github.io/zuul/javadoc/zuul-core/com/netflix/zuul/ZuulFilter.html
dragontree101
@dragontree101
Mar 06 2017 07:17
my question likes
https://github.com/spring-cloud/spring-cloud-netflix/issues/834
dragontree101
@dragontree101
Mar 06 2017 07:26
@magixsource i want to add post body in zuul's filter
dragontree101
@dragontree101
Mar 06 2017 08:04
?
Dave Syer
@dsyer
Mar 06 2017 08:25
There's no API in Zuul for the request body
You could wrap the request (like we do in the FormBodyRequestWrapper)
dragontree101
@dragontree101
Mar 06 2017 08:26
orz it is a hard work to me ....
Dave Syer
@dsyer
Mar 06 2017 08:26
Or you could change the HTTP cllient call (bypass the routing filter)
dragontree101
@dragontree101
Mar 06 2017 08:26
thanks !
dragontree101
@dragontree101
Mar 06 2017 08:57
@dsyer if i warp like FormBodyRequestWrapper, does i should stop origin FormBodyWrapperFilter?
Dave Syer
@dsyer
Mar 06 2017 09:00
You mean, do you need to stop the wrapper being created?
Probably wouldn't hurt.
dragontree101
@dragontree101
Mar 06 2017 09:17
i read source , because of i re set request by my self filter, so origin FormBodyRequestWrapper it doesn't work
right?
Dave Syer
@dsyer
Mar 06 2017 10:07
So far, so good
dragontree101
@dragontree101
Mar 06 2017 10:29
i found FormBodyRequestWrapper this.request.getParameterMap().entrySet() read inputstream, can my Wrapper can not read origin body... how should i do next?