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

Different response data and status codes #40

Open
patricks opened this issue Aug 13, 2018 · 1 comment
Open

Different response data and status codes #40

patricks opened this issue Aug 13, 2018 · 1 comment

Comments

@patricks
Copy link

Hi,

is there a way to switch the response data and response code on every request?

I have ui test which should return a 401 status code in the first two requests and in the third request it should return a 200 response. Is there a way to get this working?

@fangpenlin
Copy link
Contributor

@patricks yes, but not with Ambassador's build-in response classes. I think that's a legit requirement, will think about it for the future version. But in the mean time, you can use lower level Embassy SWSGI application

https://github.com/envoy/Embassy#example
https://github.com/envoy/Ambassador/blob/master/Ambassador/Responses/DataResponse.swift#L62-L83

You can see these example about how to return any desired header with startResponse function

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