0

I currently have replaced httpurlconnection to feign-okhttp in my projects. I use the following edition:

    <dependency>
        <groupId>io.github.openfeign</groupId>
        <artifactId>feign-okhttp</artifactId>
        <version>9.6.0</version>
    </dependency>

but I got a problem when I post this url: "http://gclife-platform-service:20000/v1/user/login/log?userId=ea9dd2f707a54b11b03193c35b2ad3a4&error=SUCCESS" The log from server side as following:

Received [1.1
cache-control: no-cache
...

But "Received [1.1" should be:

Received [POST v1/user/login/log?userId=ea9dd2f707a54b11b03193c35b2ad3a4&error=SUCCESS HTTP/1.1 

So this caused the parse problem.

2018-05-05 10:10:04.076 DEBUG 6525 --- [io-20000-exec-9] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

when I post url with no query parameters like "http://gclife-platform-service:20000/v1/message/sms/verifycode/check", I got:

Received [POST /v1/message/sms/verifycode/check HTTP/1.1

This is the correct result. How can I get the correct log like this? Can anyone help? Thanks.

2 Answers2

0

This exception can occur when you try to execute https request from client on endpoint which isn't https enabled. Client will encrypt request data when server is expecting raw data.

Change https:// to http:// in your client url.

Yogendra Mishra
  • 2,399
  • 2
  • 13
  • 20
0

I made the same mistake. print Feign header and find Content-Length was duplicate definition. enter image description here

amoyiki
  • 11
  • 4