Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: HTTP 400 on mirror update when Content-Type application/json is set #1122

Open
sinuscosinustan opened this issue Oct 6, 2022 · 1 comment

Comments

@sinuscosinustan
Copy link

Detailed Description

When the Content-Type header is set to application/json on a mirror update via API (no matter if async or not), the API throws HTTP 400 and {"error":"EOF"}.

python3 test.py update --async ceph-quincy-focal
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:9091
send: b'PUT /api/mirrors/ceph-quincy-focal?_async=true HTTP/1.1\r\nHost: localhost:9091\r\nUser-Agent: python-requests/2.25.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nContent-Length: 0\r\n\r\n'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Date: Thu, 06 Oct 2022 15:12:13 GMT
header: Content-Length: 15
header: Content-Type: text/plain; charset=utf-8
DEBUG:urllib3.connectionpool:http://localhost:9091 "PUT /api/mirrors/ceph-quincy-focal?_async=true HTTP/1.1" 400 15
{'error': 'EOF'}

Context

I tried to update a mirror via API with a generic method which sets the Content-Type to application/json by default.

Your Environment

$ aptly version
aptly version: '1.5.0'
@xaoc7
Copy link

xaoc7 commented Nov 17, 2022

Probably it is a silly question...
But do we actually need to provide header Content-Type since on mirror update we are not uploading any files? I can confirm that without setting Content-Type mirrors can be successfully updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants