Sharath Chandran
Sharath Chandran

Reputation: 159

Karate POST request returned Invalid content type message for REST POST transaction

Given url 'https://api-xxxxxxxxxxxxxxx/xxxxx/'

// in the above line "checkUsernamePassword" automatically changes to (lower case u & p) "checkusernamepassword" during request process in Karate.

// i.e it changes to 'application/xxx.pingixxxxx.checkusernamepassword+json' during POST request

And request { Username: '12345xxx', Password:'12233xxx'}

When method post

Karate response is { "code": "INVALID_CONTENT_TYPE" "message": Invalid content type xxxxx}

Case 1: I reproduced same error response with Postman when I used u & p lowercase Content_Type = 'application/xxx.pingixxxxxxx.checkusernamepassword+json'

Case 2: I got valid response in Postman when I used U&P upper case Content_Type = 'application/xxx.pingixxxxxxx.checkUsernamePassword+json' in Postman.

Please clarify how I can force header Content-Type in Karate with upper case U & P or some other keyword can be used to resolve this issue

Upvotes: 1

Views: 477

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58153

Yes it does look like there is an issue. We are working on the new version, it looks to be fixed, perhaps you can confirm as well: https://github.com/intuit/karate/commit/19d1fe0ab33728044902f5f3a2f7d27b881c898d

You can try switching to karate-jersey instead of karate-apache. If that does not work, help us by testing the upcoming version so that we can release it faster: https://github.com/intuit/karate/wiki/1.0-upgrade-guide

Upvotes: 1

Related Questions