spring-guides / tut-rest

Building REST services with Spring :: Learn how to easily build RESTful services with Spring

Home Page:https://spring.io/guides/tutorials/rest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: java.lang.IllegalArgumentException: Invalid character found in method name [] . HTTP method names must be tokens

AAdewunmi opened this issue · comments

I had the same problem using Eclipse STS.

Screenshot 2022-11-15 at 11 11 16

Mozilla Error:

Screenshot 2022-11-15 at 11 11 01

Simple fix:

It has to do with using http//: instead of https//: e.g.

Employee API makes the following call:

$ curl -v localhost:8080/employees

or

$ curl -v https://localhost:8080/employees

Orders API makes the following call:

$ curl -v http://localhost:8080/orders

Essentially, swapping "http" with "https", when testing your API end points, will fix the problem.

😎

Hi @AAdewunmi. What error do you get when you run the curl commands from a terminal or command prompt? The error I see is from Mozilla and Eclipse STS which puts another layer in between the request and the response. When I went through the tutorial it worked with the commands as is, but did not work with https.