Tip
Tip

Reputation: 19

Receiving Invalid character found in method name on GET request

I'm trying to utilize a MapBox api in my backend, but am receiving this error. I've never seen this before. Is there something I need to do to configure my endpoint?

Error -

java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x010x020x000x010x000x010xfc0x030x03mA0xe8&0x1f0xfa80xcd0x1b0x900xec!0xfd0xb30x04<0xcb0xa20x16@0x96H0x180x88[0xf90xeb0xbeK?^0xc8]. HTTP method names must be tokens

Service -

public String getTarget() {
    TargetLocation location = targetLocationRepository.findTargetLocationById();
    String lat = location.getLatitude();
    String lng = location.getLongitude();
    return "https://api.mapbox.com/geocoding/v5/mapbox.places/"+lat+","+lng+".json?access_token=${"+MAPBOX_ACCESS_TOKEN+"}";
}

Controller -

@GetMapping(value = "getTarget")
public String getTarget() {
    return targetLocationService.getTarget();
}

Upvotes: 0

Views: 2359

Answers (2)

Kanika Sharma
Kanika Sharma

Reputation: 137

The method is expecting you to use HTTP instead of HTTPS.

Upvotes: -1

Jo&#227;o Dias
Jo&#227;o Dias

Reputation: 17460

It seems that this might be related to HTTPS. It occurs when you try to execute HTTPS request from client on endpoint that has not HTTPS enabled. Use http: (http://api.mapbox.com/geocoding/v5/mapbox.places) in your client instead.

Upvotes: 2

Related Questions