INNER CODE UNIT · Go

validateAndSetDefaults

andrearaponi/dito · config/config.go:175

func validateAndSetDefaults(config *ProxyConfig) error {
	// Set default global response body size limit if not specified (100MB)
	if config.ResponseLimits.MaxResponseBodySize == 0 {
		config.ResponseLimits.MaxResponseBodySize = 100 * 1024 * 1024 // 100MB default
	}

	// Validate global response body size limit
	if config.ResponseLimits.MaxResponseBodySize < 0 {
		return fmt.Errorf("global max_response_body_size cannot be negative")
	}

	// Set default request timeout if not specified
	if config.RequestTimeout == 0 {
		config.RequestTimeout = 30 * time.Second // 30 seconds default
	}

	// Validate per-location response body size limits
	for _, location := range config.Locations {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…