|
|
@ -46,8 +46,8 @@ const ( |
|
|
|
RequestTimeTooSkewed = iota |
|
|
|
RequestTimeTooSkewed = iota |
|
|
|
BandWidthQuotaExceeded |
|
|
|
BandWidthQuotaExceeded |
|
|
|
BandWidthInsufficientToProceed |
|
|
|
BandWidthInsufficientToProceed |
|
|
|
SlowDown |
|
|
|
|
|
|
|
ConnectionLimitExceeded |
|
|
|
ConnectionLimitExceeded |
|
|
|
|
|
|
|
SlowDown |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// Golang http doesn't implement these
|
|
|
|
// Golang http doesn't implement these
|
|
|
@ -77,12 +77,17 @@ func writeErrorHeaders(w http.ResponseWriter) { |
|
|
|
var errorCodeResponse = map[int]Error{ |
|
|
|
var errorCodeResponse = map[int]Error{ |
|
|
|
BandWidthQuotaExceeded: { |
|
|
|
BandWidthQuotaExceeded: { |
|
|
|
Code: "BandwidthQuotaExceeded", |
|
|
|
Code: "BandwidthQuotaExceeded", |
|
|
|
Description: "Bandwidth Quota Exceeded", |
|
|
|
Description: "Bandwidth Quota Exceeded.", |
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
}, |
|
|
|
}, |
|
|
|
BandWidthInsufficientToProceed: { |
|
|
|
BandWidthInsufficientToProceed: { |
|
|
|
Code: "BandwidthQuotaWillBeExceeded", |
|
|
|
Code: "BandwidthQuotaWillBeExceeded", |
|
|
|
Description: "Bandwidth quota will be exceeded with this request", |
|
|
|
Description: "Bandwidth quota will be exceeded with this request.", |
|
|
|
|
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
ConnectionLimitExceeded: { |
|
|
|
|
|
|
|
Code: "ConnectionLimitExceeded", |
|
|
|
|
|
|
|
Description: "Connections Limit Exceeded.", |
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
}, |
|
|
|
}, |
|
|
|
SlowDown: { |
|
|
|
SlowDown: { |
|
|
@ -90,11 +95,6 @@ var errorCodeResponse = map[int]Error{ |
|
|
|
Description: "Reduce your request rate.", |
|
|
|
Description: "Reduce your request rate.", |
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
}, |
|
|
|
}, |
|
|
|
ConnectionLimitExceeded: { |
|
|
|
|
|
|
|
Code: "ConnectionLimit", |
|
|
|
|
|
|
|
Description: "Connection Limit Met", |
|
|
|
|
|
|
|
HTTPStatusCode: StatusTooManyRequests, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Write error response headers
|
|
|
|
// Write error response headers
|
|
|
|