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

A way to specify returned HTTP code when calling TimeoutError #20

Closed
Taik opened this issue Dec 16, 2015 · 3 comments
Closed

A way to specify returned HTTP code when calling TimeoutError #20

Taik opened this issue Dec 16, 2015 · 3 comments

Comments

@Taik
Copy link

Taik commented Dec 16, 2015

Currently, we need to call ctx.TimeoutError() if we wish to return from the request, which in turn sets the status code to StatusRequestTimeout.

Should there be another function:
func (*RequestCtx) TimeoutErrorWithCode(statusCode int, msg string)
which lets the user override the status code and message?

@valyala
Copy link
Owner

valyala commented Dec 16, 2015

Done.

@valyala
Copy link
Owner

valyala commented Dec 17, 2015

@Taik , fasthttp now has more generic TimeoutErrorWithResponse function. With this function you can set arbitrary status code, headers and body as 'timeout error' message.

@Taik
Copy link
Author

Taik commented Dec 17, 2015

Awesome--thanks for the quick turnaround @valyala!

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

2 participants