Documentation

Std.Http.Test.Helpers

@[instance_reducible]
Equations
  • One or more equations did not get rendered due to their size.

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

Equations
Instances For

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

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

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

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Std.Http.Internal.Test.checkClose (name raw : String) (handler : TestHandler) (expect : ByteArray → IO 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).

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def Std.Http.Internal.Test.checkTimed (name : String) (ms : Nat := 2000) (raw : String) (handler : TestHandler) (expect : ByteArray → IO Unit) (config : Config := defaultConfig) :

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

          Equations
          Instances For

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

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

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

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Assert needle appears anywhere in the response.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Assert needle does NOT appear in the response.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

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

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      An error response the server writes itself: status with content as its text/plain content.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        Equations
                        Instances For
                          Equations
                          Instances For
                            Equations
                            Instances For
                              Equations
                              Instances For
                                Equations
                                Instances For
                                  Equations
                                  Instances For

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

                                    Equations
                                    Instances For

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

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Respond 200 with the request URI as the body.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        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.

                                          Equations
                                          Instances For

                                            GET with Connection: close.

                                            Equations
                                            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.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              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).

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

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

                                                  Equations
                                                  Instances For

                                                    The terminal zero-chunk that ends a chunked body.

                                                    Equations
                                                    Instances For