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

Better API document about status/header in Response #66

Open
springside opened this issue Feb 27, 2014 · 3 comments
Open

Better API document about status/header in Response #66

springside opened this issue Feb 27, 2014 · 3 comments

Comments

@springside
Copy link

most time we need to set both header/status and content, i spend much time to findout how to set a json response with content-type header -- use the "with()", please document it out.

server.request(by("foo")).response(header("content-type", "application/json"));

the real sample should has the json content here.

PS. now we has the json shortcut. But i still need to set bot status code(500) and error reason text.

@dreamhead
Copy link
Owner

I've documented composite Java API design which could help you know more about API.
https://github.com/dreamhead/moco/blob/master/moco-doc/apis.md#composite-java-api-design

What does "status code and error reason text" mean?

@yayj
Copy link

yayj commented Feb 4, 2015

Then what about response(seq("status 500 with error message", "status 200 with result"))?

@dreamhead
Copy link
Owner

server.response(seq(and(status(500), with(text("Error Message"))), and(status(200), with(text("Result")))));

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

2 participants