1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2026-04-23 19:41:06 +02:00
Files
2026-02-27 16:57:11 +01:00

25 lines
562 B
Go

package conditionalheaders
import "net/http"
// Factory is responsible for creating Request instances from user requests.
type Factory struct {
config *Config
}
// NewFactory creates a new Factory instance with the given configuration.
func NewFactory(c *Config) (*Factory, error) {
if err := c.Validate(); err != nil {
return nil, err
}
return &Factory{
config: c,
}, nil
}
// NewRequest creates a new Request instance from the given user request.
func (p *Factory) NewRequest(req *http.Request) *Request {
return newFromRequest(p.config, req)
}