File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1194,19 +1194,21 @@ Quit and restart your server now that you've updated the code::
1194
1194
1195
1195
.. nextslide :: What About a Browser?
1196
1196
1197
- Quit and restart your server, now that you've updated the code.
1197
+ The server quit during the tests, but an HTTP request from the browser should
1198
+ work fine now.
1198
1199
1199
1200
.. rst-class :: build
1200
1201
.. container ::
1201
1202
1202
- Reload your browser. It should work fine.
1203
+ Restart the server and reload your browser. You should see your OK
1204
+ response.
1203
1205
1204
1206
We can use the ``simple_client.py `` script in our resources to test our
1205
1207
error condition. In a second terminal window run the script like so::
1206
1208
1207
1209
$ python simple_client.py "POST / HTTP/1.0\r\n\r\n"
1208
1210
1209
- You'll have to quit the client pretty quickly with `` ctrl-c ``
1211
+ This should cause the server to crash.
1210
1212
1211
1213
1212
1214
Step 3: Error Responses
@@ -1296,9 +1298,9 @@ Luckily, there's an error code that is tailor-made for this situation.
1296
1298
def response_method_not_allowed ():
1297
1299
""" returns a 405 Method Not Allowed response"""
1298
1300
resp = []
1299
- resp.append(" HTTP/1.1 405 Method Not Allowed" )
1300
- resp.append(" " )
1301
- return " \r\n " .join(resp)
1301
+ resp.append(b " HTTP/1.1 405 Method Not Allowed" )
1302
+ resp.append(b " " )
1303
+ return b " \r\n " .join(resp)
1302
1304
1303
1305
1304
1306
.. nextslide :: Server Updates
You can’t perform that action at this time.
0 commit comments