@@ -25,28 +25,8 @@ let requestCounter: HttpHandler =
25
25
26
26
requestCounter.WithLabels( endpoint, method, statusCode). Inc()
27
27
28
- // Skip the remaining pipeline
29
- //
30
- // WARNING!!!!
31
- //
32
- // We need to return `Some ctx` instead of `None` here, otherwise, when
33
- // reaching the **handleResult** (https://github.com/giraffe-fsharp/Giraffe/blob/master/src/Giraffe/EndpointRouting.fs#L101-L104)
34
- // Giraffe will try to set the response status code for a request that
35
- // was already finished. This will throw some exception that one can
36
- // finds at the server logs.
37
- //
38
- // Something that I still don't fully understand is why this exception
39
- // related to the status code change does not happen for all the cases.
40
- // When testing it was only happening when the /api/prediction endpoint
41
- // fails (i.e., throws an exception itself).
42
- //
43
- // To test this error locally, just change this "return Some ctx" to
44
- // "return None", start the API and use the /api/prediction endpoint with
45
- // an invalid payload, like:
46
- //
47
- // curl -X POST -H "Accept: application/json" -d '{"id":"1", "crimesPerCapta":0.01}' localhost:8088/api/prediction
48
- //
49
- // P.S.: Notice that the id is a string instead of an integer ^.
28
+ // Check this discussion for why we can't use return None:
29
+ // - https://github.com/giraffe-fsharp/Giraffe/discussions/659
50
30
return Some ctx
51
31
}
52
32
0 commit comments