Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Adding a Server header to API responses #125
Conversation
farodin91
added
component/api
type/improvement
labels
Dec 13, 2016
|
Could you add some tests? |
|
Just added some tests. I didn't see a good example of tests directed specifically toward the middleware so this is what I came up with. Let me know what you think. |
| + remote_addr: "localhost:3000".to_socket_addrs().unwrap().next().unwrap(), | ||
| + local_addr: "localhost:3000".to_socket_addrs().unwrap().next().unwrap(), | ||
| + headers: Headers::new(), | ||
| + body: unsafe { ::std::mem::uninitialized() }, // FIXME(reem): Ugh |
jimmycuadra
Dec 20, 2016
Owner
I don't want to introduce any unsafe blocks into Ruma, even if Iron does it. Will it work to just use the iron-test crate to test this functionality?
jstnlef
Dec 21, 2016
Contributor
Erm well I could just use iron-test to make a request to an r0 prefixed endpoint and verify that the response has the included headers. It's not quite correct or vigorous but should get the job done. Let me know if I should do that and I will.
|
Modified the tests to remove the unsafe bits. |
jimmycuadra
merged commit 5dbf75f
into
ruma:master
Dec 21, 2016
1 check passed
|
Thanks much! |
jstnlef commentedDec 12, 2016
Adding a server header as well as the current CORS headers to responses. This mimics Synapses behavior of adding its server name and version to API responses.