Documentation

Std.Http.Test.Helpers

@[implicit_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 : ByteArrayIO 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 : 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).

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

          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
                      Equations
                      • Std.Http.Internal.Test.r400 = "HTTP/1.1 400 Bad Request\x0d\nServer: LeanHTTP/1.1\x0d\nConnection: close\x0d\nContent-Length: 0\x0d\n\x0d\n"
                      Instances For
                        Equations
                        • Std.Http.Internal.Test.r408 = "HTTP/1.1 408 Request Timeout\x0d\nServer: LeanHTTP/1.1\x0d\nConnection: close\x0d\nContent-Length: 0\x0d\n\x0d\n"
                        Instances For
                          Equations
                          • Std.Http.Internal.Test.r413 = "HTTP/1.1 413 Content Too Large\x0d\nServer: LeanHTTP/1.1\x0d\nConnection: close\x0d\nContent-Length: 0\x0d\n\x0d\n"
                          Instances For
                            Equations
                            • Std.Http.Internal.Test.r417 = "HTTP/1.1 417 Expectation Failed\x0d\nServer: LeanHTTP/1.1\x0d\nConnection: close\x0d\nContent-Length: 0\x0d\n\x0d\n"
                            Instances For
                              Equations
                              • Std.Http.Internal.Test.r431 = "HTTP/1.1 431 Request Header Fields Too Large\x0d\nServer: LeanHTTP/1.1\x0d\nConnection: close\x0d\nContent-Length: 0\x0d\n\x0d\n"
                              Instances For
                                Equations
                                • Std.Http.Internal.Test.r505 = "HTTP/1.1 505 HTTP Version Not Supported\x0d\nServer: LeanHTTP/1.1\x0d\nConnection: close\x0d\nContent-Length: 0\x0d\n\x0d\n"
                                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