Unstructured-IO / Unstructured-IO/unstructured-api

bug/output_format param does not work when Accept header is sent

Open
#195 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
951
Forks
192
Avg merge
7d 8h
Merged PRs (30d)
2

Description

This returns json:

curl 'http://localhost:8000/general/v0/general' --header 'Accept: application/json' --form files=@sample-docs/layout-parser-paper-fast.pdf --form output_format="text/csv"

And this returns csv:

curl 'http://localhost:8000/general/v0/general' --form files=@sample-docs/layout-parser-paper-fast.pdf --form output_format="text/csv"

I think we want some sort of indication that the Accept header is overriding the output_type, maybe an error when both are present with different filetypes?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two curl requests from the issue against the general endpoint, then inspect the request handling for Accept and output_format. Define and test the expected behavior when both specify different formats; done means the endpoint no longer silently returns JSON when output_format requests CSV.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.