I’m stuck on Stage #AT4
I’ve tried to uncomment and do the first stage, but it failed
Here are my logs:
remote: ------------------------------------------------------------------------
remote:
remote: ⚡ This is a turbo test run. https://codecrafters.io/turbo
remote:
remote: Running tests on your code. Logs should appear shortly...
remote:
remote: [compile] Determining projects to restore...
remote: [compile] Restored /app/codecrafters-http-server.csproj (in 77 ms).
remote: [compile] codecrafters-http-server -> /app/bin/Release/net8.0/codecrafters-http-server.dll
remote: [compile]
remote: [compile] Build succeeded.
remote: [compile] 0 Warning(s)
remote: [compile] 0 Error(s)
remote: [compile]
remote: [compile] Time Elapsed 00:00:03.82
remote: [compile] Compilation successful.
remote:
remote: Debug = true
remote:
remote: [tester::#IA4] Running tests for Stage #IA4 (Respond with 200)
remote: [tester::#IA4] Running program
remote: [tester::#IA4] $ ./your_server.sh
remote: [your_program] Logs from your program will appear here!
remote: [tester::#IA4] Connected to localhost port 4221
remote: [tester::#IA4] $ curl -v http://localhost:4221/
remote: [tester::#IA4] > GET / HTTP/1.1
remote: [tester::#IA4] > Host: localhost:4221
remote: [tester::#IA4] >
remote: [tester::#IA4] Sent bytes: "GET / HTTP/1.1\r\nHost: localhost:4221\r\n\r\n"
remote: [tester::#IA4] Failed to read response:
remote: [tester::#IA4] Received: "" (no content received)
remote: [tester::#IA4] ^ error
remote: [tester::#IA4] Error: Expected: HTTP-version, Received: ""
remote: [tester::#IA4] Test failed
remote: [tester::#IA4] Terminating program
remote: [tester::#IA4] Program terminated successfully
remote:
remote: View our article on debugging test failures: https://codecrafters.io/debug
remote:
To https://git.codecrafters.io/bc0b0f218d865dab
35f3e36..0ffde22 master -> master
And here’s a snippet of my code:
using System.Net;
using System.Net.Sockets;
// You can use print statements as follows for debugging, they'll be visible when running tests.
Console.WriteLine("Logs from your program will appear here!");
// Uncomment this block to pass the first stage
TcpListener server = new TcpListener(IPAddress.Any, 4221);
server.Start();
server.AcceptSocket(); // wait for client
I tried the same challenge in python and it succeeded without error