Search code examples
angularjsscalapostmanakka-httpspray-client

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 i.e 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

            }
        }
        }
      }

Solution

  • 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