Bix icon indicating copy to clipboard operation
Bix copied to clipboard

incorrect status when sleeping in bun http handler

Open joprice opened this issue 1 year ago • 1 comments

Describe the bug

I have a simple handler that sets the status code to 500 and returns a text body. This works as expected, however when I add a sleep, the body is returned correctly, but the status is 200.

Router.get (                                                                                    
        "/status",                                                                                      
        (fun next ctx -> promise {
          do! Promise.sleep 1000 // <- adding this line causes the status set below to be ignored
          return! (setStatusCode 500 >=> sendText "error") next ctx                                      
        })   

Adapter

  • [x] Bix
  • [x] Bix.Bun
  • [ ] Bix.Deno
  • [ ] Bix.Cloudflare

Runtime And Version

  • [ ] Node ->
  • [x] Bun -> 1.1.8
  • [ ] Deno ->
  • [ ] Cloudflare ->

joprice avatar May 17 '24 20:05 joprice

Hey there, v1.0.0-beta-006 is on nuget indexing and includes your fix, please let me know if you find something weird there otherwise feel free to close this!

AngelMunoz avatar May 22 '24 03:05 AngelMunoz

I was able to resolve the new release and it's working. Thank you!

joprice avatar Jun 19 '24 17:06 joprice