Re: [go-nuts] issue with sending JSON via HTTP

2016-10-25 Thread Henrik Johansson
It seems like you encode the valid json string?
If you have a string that is json you should be able to post the string as
is no?

Just make sure you set the application/json content type.

tis 25 okt. 2016 kl 14:32 skrev Rich :

> Hi All,
>
> I have code that is similar to this:
> https://play.golang.org/p/zZ8EQ-R6cb
>
> When I run it I get the following error:
> 2016/10/25 12:19:56 Body: 400 {"message":"The JSON stream reader doesn't
> support chunking."}
>
> So I changed my code to this:
> https://play.golang.org/p/NYV5SdCtnt
>
> and I get the following error:
> 2016/10/25 12:28:28 Body: 400 {"message":"Expecting an array or an
> object."}
>
> This curl command is successful:
> curl -vv -u m11...@myjob.com:mypas$ -H 'Content-Type:application/json' -X
> POST -d @/home/m1/helloworld.json
> http://someupload.myjob.com:8080/events/com.myjob.upload
>
>
> helloworld.json looks like this:
> {
>   "Name": "Operational Demo MR",
>   "greeting": "Hello  World"
> }
>
> I am not sure what it's looking for... any help would be appreciated.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] issue with sending JSON via HTTP

2016-10-25 Thread Rich
Hi All,

I have code that is similar to this:
https://play.golang.org/p/zZ8EQ-R6cb

When I run it I get the following error:
2016/10/25 12:19:56 Body: 400 {"message":"The JSON stream reader doesn't 
support chunking."}

So I changed my code to this:
https://play.golang.org/p/NYV5SdCtnt

and I get the following error:
2016/10/25 12:28:28 Body: 400 {"message":"Expecting an array or an object."}

This curl command is successful:
curl -vv -u m11...@myjob.com:mypas$ -H 'Content-Type:application/json' -X 
POST -d @/home/m1/helloworld.json 
http://someupload.myjob.com:8080/events/com.myjob.upload


helloworld.json looks like this:
{
  "Name": "Operational Demo MR",
  "greeting": "Hello  World"
}

I am not sure what it's looking for... any help would be appreciated. 


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.