Documentation

Std.Http.Test.Helpers

@[reducible, inline]
Instances For

    Default config for server tests. Short lingering timeout, no Date header.

    Instances For

      Run tests and wrap any failure message with the group name. Use as #eval runGroup "Topic" do ....

      Instances For
        def Std.Http.Internal.Test.check (name raw : String) (handler : TestHandler) (expect : ByteArrayIO Unit) (config : Config := defaultConfig) :

        Create a fresh mock connection, send raw, and run assertions.

        Instances For
          def Std.Http.Internal.Test.checkClose (name raw : String) (handler : TestHandler) (expect : ByteArrayIO Unit) (config : Config := defaultConfig) :

          Like check but closes the client channel before running the server. Use for tests involving truncated input or silent-close (EOF-triggered behavior).

          Instances For
            def Std.Http.Internal.Test.checkTimed (name : String) (ms : Nat := 2000) (raw : String) (handler : TestHandler) (expect : ByteArrayIO Unit) (config : Config := defaultConfig) :

            Like check wrapped in a wall-clock timeout. Required when the test involves streaming, async timers, or keep-alive behavior.

            Instances For

              Assert the response starts with prefix_ (e.g. "HTTP/1.1 200").

              Instances For

                Assert the response is byte-for-byte equal to expected. Use sparingly — prefer assertStatus + assertContains for 200 responses.

                Instances For

                  Assert needle appears anywhere in the response.

                  Instances For

                    Assert needle does NOT appear in the response.

                    Instances For

                      Assert the response contains exactly n occurrences of "HTTP/1.1 ".

                      Instances For

                        Always respond 200 "ok" without reading the request body.

                        Instances For

                          Read the full request body and echo it back as text/plain.

                          Instances For

                            Respond 200 with the request URI as the body.

                            Instances For
                              def Std.Http.Internal.Test.mkGet (path : String := "/") (extra : String := "") :

                              Minimal GET request. extra is appended as raw header lines (each ending with \x0d\n) before the blank line.

                              Instances For

                                GET with Connection: close.

                                Instances For
                                  def Std.Http.Internal.Test.mkPost (path body : String) (extra : String := "") :

                                  POST with a fixed Content-Length body. extra is appended before the blank line.

                                  Instances For
                                    def Std.Http.Internal.Test.mkChunked (path chunkedBody : String) (extra : String := "") :

                                    POST with Transfer-Encoding: chunked. chunkedBody is the pre-formatted body (use chunk + chunkEnd to build it).

                                    Instances For

                                      Format a single chunk: <hex-size>\x0d\n<data>\x0d\n.

                                      Instances For

                                        The terminal zero-chunk that ends a chunked body.

                                        Instances For