Skip to content

Add Content-Type header to import requests#12902

Merged
mekarpeles merged 3 commits into
internetarchive:masterfrom
jimchamp:importer-content-type
Jun 11, 2026
Merged

Add Content-Type header to import requests#12902
mekarpeles merged 3 commits into
internetarchive:masterfrom
jimchamp:importer-content-type

Conversation

@jimchamp

Copy link
Copy Markdown
Collaborator

Adds Content-Type headers to importbot /api/import requests. Our WAF has been dropping such requests due to missing headers.

Technical

Testing

Screenshot

Stakeholders

Copilot AI review requested due to automatic review settings June 11, 2026 22:03
@jimchamp jimchamp added the Patch Deployed This PR has been deployed to production independently, outside of the regular deploy cycle. label Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses WAF-dropped importbot requests by ensuring /api/import calls include an appropriate Content-Type header, improving request acceptance reliability for import operations.

Changes:

  • Added Content-Type: application/json to importbot’s /api/import requests in scripts/manage-imports.py.
  • Updated the OpenLibrary.import_data client method to accept optional request headers and forward them to _request.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/manage-imports.py Sends /api/import requests with Content-Type: application/json when importing direct JSON payloads (item.data).
openlibrary/api.py Extends OpenLibrary.import_data to accept and pass through custom headers to the underlying request method.

Comment thread openlibrary/api.py Outdated
mekarpeles and others added 2 commits June 11, 2026 15:46
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mekarpeles mekarpeles merged commit c7bf2de into internetarchive:master Jun 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Patch Deployed This PR has been deployed to production independently, outside of the regular deploy cycle.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants