405 on post to https with basic auth and json body

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

405 on post to https with basic auth and json body

devnewb
Hi Guys.

I am undoubtedly doing something horribly wrong, trying to piece too many pieces together not knowing what I am doing.

My code is:

val req = :/("someurl.com").as("some-user", "some-password") / "api/something/" << ("{'some_key': ['some_array_val'], 'some_other_key': {'inner_key': 'some_value'}}", "application/json")

this is at least accepted in the repl, but then:

Http(req >>> System.out)

fails with:

Unexpected response code: 405

so which bit am I doing wrong (could be more than one bit :-(  ).

I can curl successfully.

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: 405 on post to https with basic auth and json body

n8han
Administrator
On 05/07/2011 06:35 PM, devnewb [via Databinder] wrote:
> Unexpected response code: 405
>
> so which bit am I doing wrong (could be more than one bit :-(  ).
>
> I can curl successfully.
>

Are you sure the service accepts a post; is curl doing a post?

Nathan
Reply | Threaded
Open this post in threaded view
|

Re: 405 on post to https with basic auth and json body

devnewb
Hi.

Yes to both.  Definitely posting with curl.
Reply | Threaded
Open this post in threaded view
|

Re: 405 on post to https with basic auth and json body

n8han
Administrator
On 05/07/2011 07:07 PM, devnewb [via Databinder] wrote:
> Hi.
>
> Yes to both.  Definitely posting with curl.

What about Dispatch's debug message, which is printed to standard out if
you're in the console. Dose it report a POST? e.g.

scala> h(url("http://dispatch.databinder.net/") << Map("one" -> "two")
 >>> System.out)
INF [20110509-16:02:29.125] RequestLogging: dispatch.databinder.net POST
/ HTTP/1.1