Creates HTTP requests for testing handlers.
// Source: https://github.com/golang/go | License: BSD-3-Clause | Copyright 2009 The Go Authors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package httptest provides utilities for HTTP testing.
package httptest
import (
"bufio"
"bytes"
"context"
"crypto/tls"
"io"
"net/http"
"strings"
)
// NewRequest wraps NewRequestWithContext using context.Background.
func NewRequest(method, target string, body io.Reader) *http.Request {
return NewRequestWithContext(context.Background(), method, target, body)
}
// NewRequestWithContext returns a new incoming server Request, suitable
// for passing to an [http.Hand
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key