7cd0edf7ff
- backfill quarantine_days<=0 to 3 with migration 0006 - reject quarantine_enabled with quarantine_days<1 on create and update - cap upstream Last-Modified at now - answer 503 with Retry-After when the first-seen lookup fails
17 lines
439 B
Go
17 lines
439 B
Go
package v1
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"git.unkin.net/unkin/artifactapi/internal/proxy"
|
|
)
|
|
|
|
func TestWriteProxyErrorRetryAfter(t *testing.T) {
|
|
w := httptest.NewRecorder()
|
|
writeProxyError(w, &proxy.ProxyError{Status: 503, Message: "quarantine check unavailable", RetryAfter: 30})
|
|
if w.Code != 503 || w.Header().Get("Retry-After") != "30" {
|
|
t.Errorf("code %d, Retry-After %q", w.Code, w.Header().Get("Retry-After"))
|
|
}
|
|
}
|