Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send JSON or raw body #27

Closed
cboden opened this issue May 17, 2013 · 8 comments
Closed

Send JSON or raw body #27

cboden opened this issue May 17, 2013 · 8 comments

Comments

@cboden
Copy link
Contributor

cboden commented May 17, 2013

I'm trying to test a POST where the body type is expected to be JSON (not a query string):

POST /api HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
Host: localhost

{"hello": "world"}

Is this possible?

@cboden
Copy link
Contributor Author

cboden commented May 17, 2013

Found #21

I couldn't find the source to the http://frisbyjs.com site. Is it available? I'd like to make a PR to the documentation on how to do this.

@vlucas
Copy link
Owner

vlucas commented May 18, 2013

Unfortunately, the site is currently in a CMS, so that is why the source is not on GitHub. I do want to move it to a static site or GitHub pages, but it has not been done yet.

@cboden
Copy link
Contributor Author

cboden commented May 18, 2013

If you have the time I think it'd be beneficial to put a snippet of code on the API docs along the lines of:

frisby.create('Post JSON string as body')
    .post('http://httpbin.org/post', {
        arr: [1, 2, 3, 4],
        foo: "bar",
        bar: "baz",
        answer: 42
    }, {json: true})
    .expectHeaderContains('Content-Type', 'json')
.toss()

to show how to set a JSON object as the body as well as the appropriate JSON headers.

@vlucas
Copy link
Owner

vlucas commented Jun 27, 2013

This has been added to the bottom of the API documentation page: http://frisbyjs.com/docs/api/

@vlucas vlucas closed this as completed Jun 27, 2013
@chernetsov
Copy link

so site is still in CMS? documentation is really incomplete...

@vlucas
Copy link
Owner

vlucas commented Oct 2, 2014

No - the webiste is in hexo (a node.js static site builder) and lives here now: https://github.com/vlucas/frisby-site

@cklckl48
Copy link

{ "params":
{ "params1": 1,
"params2": 2}}
If the json raw body like this , how can I do to check this post?

@jorgemzz
Copy link

I think its because Content-Length: xxx header i missing.
Look at this. http://www.json.org/JSONRequest.html for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants