Home / File/ adaptor_test.go — fiber Source File

adaptor_test.go — fiber Source File

Architecture documentation for adaptor_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Adapters 1 imports 35 functions 8 classes

Entity Profile

Dependency Diagram

graph LR
  8ec96b38_44b4_af66_6f6f_dd60f87b680c["adaptor_test.go"]
  3c539dc4_ce70_7be5_43dc_5058a965884a["bufio"]
  8ec96b38_44b4_af66_6f6f_dd60f87b680c --> 3c539dc4_ce70_7be5_43dc_5058a965884a
  style 8ec96b38_44b4_af66_6f6f_dd60f87b680c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

//nolint:contextcheck,revive // Much easier to just ignore memory leaks in tests
package adaptor

import (
	"bufio"
	"bytes"
	"context"
	"errors"
	"fmt"
	"io"
	"net"
	"net/http"
	"net/http/httptest"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"testing"
	"time"

	"github.com/gofiber/fiber/v3"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"github.com/valyala/fasthttp"
)

const (
	expectedRequestURI = "/foo/bar?baz=123"
	expectedBody       = "body 123 foo bar baz"
	expectedHost       = "foobar.com"
	expectedRemoteAddr = "1.2.3.4:6789"
)

func Test_HTTPHandler(t *testing.T) {
	t.Parallel()

	expectedMethod := fiber.MethodPost
	expectedProto := "HTTP/1.1"
	expectedProtoMajor := 1
	expectedProtoMinor := 1
	expectedContentLength := len(expectedBody)
	expectedHeader := map[string]string{
		"Foo-Bar":         "baz",
		"Abc":             "defg",
		"XXX-Remote-Addr": "123.43.4543.345",
	}
	expectedURL, err := url.ParseRequestURI(expectedRequestURI)
	require.NoError(t, err)

	type contextKeyType string
	expectedContextKey := contextKeyType("contextKey")
	expectedContextValue := "contextValue"

	callsCount := 0
	nethttpH := func(w http.ResponseWriter, r *http.Request) {
		callsCount++
		assert.Equal(t, expectedMethod, r.Method, "Method")
		assert.Equal(t, expectedProto, r.Proto, "Proto")
		assert.Equal(t, expectedProtoMajor, r.ProtoMajor, "ProtoMajor")
		assert.Equal(t, expectedProtoMinor, r.ProtoMinor, "ProtoMinor")
// ... (1481 more lines)

Domain

Subdomains

Dependencies

  • bufio

Frequently Asked Questions

What does adaptor_test.go do?
adaptor_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in adaptor_test.go?
adaptor_test.go defines 35 function(s): Benchmark_FiberHandlerFunc, Benchmark_FiberHandlerFunc_Parallel, Benchmark_HTTPHandler, Benchmark_HTTPHandlerWithContext, TestUnixSocketAdaptor, Test_ConvertRequest, Test_CopyContextToFiberContext, Test_CopyContextToFiberContext_Safe, Test_FiberApp, Test_FiberAppDefaultPort, and 25 more.
What does adaptor_test.go depend on?
adaptor_test.go imports 1 module(s): bufio.
Where is adaptor_test.go in the architecture?
adaptor_test.go is located at middleware/adaptor/adaptor_test.go (domain: FiberCore, subdomain: Adapters, directory: middleware/adaptor).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free