Skip to content

Commit b1122e1

Browse files
committed
chore (api): remove big comment in favor of using a link that points to a giraffe discussion
1 parent 1447946 commit b1122e1

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

fsharp-api/Router/Prometheus.middleware.fs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,8 @@ let requestCounter: HttpHandler =
2525

2626
requestCounter.WithLabels(endpoint, method, statusCode).Inc()
2727

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
5030
return Some ctx
5131
}
5232

0 commit comments

Comments
 (0)