简体   繁体   中英

Postman gives error for REST based POST methods

I am using POSTMAN app for doing REST call (POST, GET) to my Scala Akka Application. if i do the same call from angularJS it works but when i fire it from POSTMAN it gives following error :

There was a problem with the requests Content-Type:
Expected 'application/json'

My POST Call is :

http://localhost:8090/user/signUp

which contains 3 request parameters which i added in Body tab of Postman. my Header requires one value ie App_Id which i added in Headers also i added

Content-Type : application/json

in Header. but still postman gives above error.

My Application Code is :

val route =
    post {
      path("user" / "signUp"){
        headerValueByName("App_Id") { app_id => {
            handleWith {

                   //application specific implementation

            }
        }
        }
      }

Thanks @tokkov & @cmbaxter for your help..finally it is worked.

I added Content-Type : application/json and App_Key : xxx in Headers. and request parameters in Raw with type Json(application/json) . Like this:

{
    "email" : "xxx",
    "name" : "TEST NAME",
    "password" : "xxx"

 }

So My problem is with adding Request Parameters which i would to add in raw but i am trying in form-data and x-www-form-urlencoded

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM