Documentation

Std.Http.Data.Body.Full

Body.Full #

A body backed by a fixed ByteArray. The first call to recv returns the full byte array as a single chunk; subsequent calls return none (end-of-stream). Closing the body marks it closed. resetInPlace resets state to ready so the body can be read again.

A body backed by a fixed ByteArray.

Unlike Body.Stream, a Full body is replayable: resetInPlace resets the state to ready so the same body can be read again.

Instances For

    Creates a Full body from a ByteArray.

    Instances For

      Creates a Full body from a String.

      Instances For

        Receives the body data. Returns the full byte array on the first call as a single chunk, then none on all subsequent calls until the cursor is reset.

        Instances For

          Closes the body, discarding any unconsumed data.

          Instances For

            Returns true when the body has been closed or consumed.

            Instances For

              Returns the known size of the remaining data. Returns some (.fixed n) with the byte count if not yet consumed, some (.fixed 0) otherwise.

              Instances For

                Non-blocking receive. Full bodies are always in-memory, so data is always immediately available. Returns some chunk on first call, some none (EOF) once consumed or closed.

                Instances For

                  Selector that immediately resolves to the remaining chunk (or EOF).

                  Instances For

                    Resets the cursor to position zero so the body can be re-read from the start. Since Full.data is always preserved in the struct, this always works regardless of whether close was previously called (e.g. by the connection loop after EOF).

                    Instances For
                      @[instance_reducible]
                      @[instance_reducible]

                      Full is replayable: resetInPlace resets the cursor to zero so the body can be re-read from the start.

                      @[instance_reducible]

                      Builds a request body from raw bytes without setting any headers. Use bytes instead if you want Content-Type: application/octet-stream set automatically.

                      Instances For

                        Builds a request with a binary body. Sets Content-Type: application/octet-stream. Use fromBytes instead if you need to set a different Content-Type or none at all.

                        Instances For

                          Builds a request with a text body. Sets Content-Type: text/plain; charset=utf-8.

                          Instances For

                            Builds a request with a JSON body. Sets Content-Type: application/json.

                            Instances For

                              Builds a request with an HTML body. Sets Content-Type: text/html; charset=utf-8.

                              Instances For

                                Builds a response body from raw bytes without setting any headers. Use bytes instead if you want Content-Type: application/octet-stream set automatically.

                                Instances For

                                  Builds a response with a binary body. Sets Content-Type: application/octet-stream. Use fromBytes instead if you need to set a different Content-Type or none at all.

                                  Instances For

                                    Builds a response with a text body. Sets Content-Type: text/plain; charset=utf-8.

                                    Instances For

                                      Builds a response with a JSON body. Sets Content-Type: application/json.

                                      Instances For

                                        Builds a response with an HTML body. Sets Content-Type: text/html; charset=utf-8.

                                        Instances For