conditional

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package conditional implements HTTP conditional request handling using If-Match, If-None-Match, If-Modified-Since, and If-Unmodified-Since headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params struct {
	IfMatch           []string  `header:"If-Match" doc:"Succeeds if the server's resource matches one of the passed values."`
	IfNoneMatch       []string  `` /* 169-byte string literal not displayed */
	IfModifiedSince   time.Time `header:"If-Modified-Since" doc:"Succeeds if the server's resource date is more recent than the passed date."`
	IfUnmodifiedSince time.Time `header:"If-Unmodified-Since" doc:"Succeeds if the server's resource date is older or the same as the passed date."`
	// contains filtered or unexported fields
}

Params holds the parsed HTTP conditional request headers for an operation.

func (*Params) Check

func (p *Params) Check(etag string, modified time.Time) (status int, msg string)

Check evaluates all conditional headers against the given ETag and modification time, returning an HTTP status code and message if a precondition fails, or zero if all preconditions pass.

func (*Params) HasConditionalParams

func (p *Params) HasConditionalParams() bool

HasConditionalParams reports whether any conditional headers were provided in the request.

func (*Params) Resolve

func (p *Params) Resolve(ctx core.Context) []error

Resolve reads the request method from the context to determine whether the current operation is a write (POST, PUT, PATCH, DELETE).

Jump to

Keyboard shortcuts

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