Giraffe stops calling my HttpHandler but somehow returns ¿cached? response

17 views Asked by At

I'm using F# and Giraffe. I look in the network tab and see the browser repeatedly fetching /forecasts. However, I set a breakpoint in the makeRandomForecasts function, and it gets invoked once and then never again. Repeated requests to /forecasts always return the same result. I expect it to return a different result for every fetch because makeRandomForecasts returns a random result.

Why is makeRandomForecasts never called more than once?

let webApp =
    choose [
        GET >=>
            choose [
                ...
                route "/forecasts" >=> noResponseCaching >=> htmlNodes (
                    Views.forecasts (makeRandomForecasts 5 DateTime.Now))
            ]
        setStatusCode 404 >=> text "Not Found" ]

Full code is here: https://github.com/surferjeff/blazor-compared/tree/d3a2158d1685f80c6b138ab0c81a63cbd37b348e/GiraffeApp

1

There are 1 answers

0
Jeffrey Rennie On

I needed a warbler: https://giraffe.wiki/docs#warbler

                route "/forecasts" >=> warbler (fun _ -> htmlNodes (
                    Views.forecasts (makeRandomForecasts 5 DateTime.Now)))