Make sure the redirects doctest actually tests something for 301 redirects

This commit is contained in:
Joshua Nelson
2020-12-03 15:45:46 -05:00
committed by Martin Algesten
parent 4a3d3c49a1
commit 37f991fa50

View File

@@ -28,6 +28,10 @@ pub(crate) fn test_agent() -> Agent {
stream.write_all(b"HTTP/1.1 200 OK\r\n")?; stream.write_all(b"HTTP/1.1 200 OK\r\n")?;
stream.write_all(b"\r\n")?; stream.write_all(b"\r\n")?;
stream.write_all(br#"{"hello": "world"}"#)?; stream.write_all(br#"{"hello": "world"}"#)?;
} else if headers.path() == "/status/301" {
stream.write_all(b"HTTP/1.1 301 Found\r\n")?;
stream.write_all(b"Location: /redirect/3\r\n")?;
stream.write_all(b"\r\n")?;
} else if headers.path() == "/status/307" { } else if headers.path() == "/status/307" {
stream.write_all(b"HTTP/1.1 307 Found\r\n")?; stream.write_all(b"HTTP/1.1 307 Found\r\n")?;
stream.write_all(b"Location: /redirect/3\r\n")?; stream.write_all(b"Location: /redirect/3\r\n")?;