response

package
v0.0.0-...-2910145 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package response 提供了对 http.response 的封装。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	http.ResponseWriter // 基础的 ResponseWriter。
	// contains filtered or unexported fields
}

Writer 封装了 http.ResponseWriter,提供了额外的功能。

func NewWriter

func NewWriter(writer http.ResponseWriter) *Writer

NewWriter 创建并返回一个新的 Writer。

func (*Writer) Flush

func (w *Writer) Flush()

Flush 将任何缓冲的数据发送到客户端。

func (*Writer) Hijack

func (w *Writer) Hijack() (conn net.Conn, writer *bufio.ReadWriter, err error)

Hijack 实现了 http.Hijacker 接口中的 Hijack 函数。

func (*Writer) IsHeaderWrote

func (w *Writer) IsHeaderWrote() bool

IsHeaderWrote 返回是否已写入头部状态。

func (*Writer) IsHijacked

func (w *Writer) IsHijacked() bool

IsHijacked 返回连接是否已被劫持。

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(status int)

WriteHeader 实现了 http.ResponseWriter 接口中的 WriteHeader 方法。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL