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

Add JSONP support #87

Closed
johanhaleby opened this issue Jul 20, 2015 · 5 comments
Closed

Add JSONP support #87

johanhaleby opened this issue Jul 20, 2015 · 5 comments

Comments

@johanhaleby
Copy link
Collaborator

E.g. 

expect().body("root.child", equalTo("x")).when("/jsonp?callback=y");

But perhaps it's better/easier to do something like:

expect().jsonp("callback", "y").body("root.child", 
equalTo("x")).when().get("/jsonp");

or:

expect().jsonp("callback").body("root.child", 
equalTo("x")).when().get("/jsonp"); 

which should generate a random method-name.

It should also be possible to set it as default:

RestAssured.expectedParser = jsonp("callback", "y");
RestAssured.expectedParser = jsonp("callback");
RestAssured.expectedParser = auto(); // Default

There should also be a JsonpPath that simply extends JsonPath and removes 
method call.

Original issue reported on code.google.com by johan.ha...@gmail.com on 10 Mar 2011 at 2:00

@johanhaleby
Copy link
Collaborator Author

[deleted comment]

@johanhaleby
Copy link
Collaborator Author

If using:

expect().body("root.child", equalTo("x")).when("/jsonp?callback=y");

we can try to detect whether or not the response is JSONP or plain JSON by e.g. 
using reg exp.

Original comment by johan.ha...@gmail.com on 10 Mar 2011 at 2:03

@johanhaleby
Copy link
Collaborator Author

We could also try to identify jsonp in JsonPath using the reg exp

Original comment by johan.ha...@gmail.com on 10 Mar 2011 at 2:50

@johanhaleby
Copy link
Collaborator Author

Perhaps jsonp spec should be in the request spec instead? E.g.

given().
         jsonp("callback").
expect().
         body("root.child", equalTo("x")).
when().
         get("/jsonp"); 

Original comment by johan.ha...@gmail.com on 22 Mar 2011 at 6:15

@johanhaleby
Copy link
Collaborator Author

Perhaps it should be a filter?

Original comment by johan.ha...@gmail.com on 22 May 2011 at 8:46

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

No branches or pull requests

1 participant