Repository navigation
feat(http): add ?format=text|csv|tsv output option - #14
Merged
Merged
Conversation
The /query endpoint defaults to JSON (canonical machine format); add an opt-in query-string 'format' for direct terminal/curl/unix-pipe use: text -> text/plain (ASCII table, via script_result_to_text) csv -> text/csv (RFC 4180) tsv -> text/tab-separated-values Unknown/absent format falls back to JSON. /help and README document it, and the README Response Format example is corrected to the real script envelope. Depends on libxsql script_result_to_csv/tsv (0xeb/libxsql#4).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in
formatquery-string parameter toPOST /query. JSON stays the default and canonical machine format — this is for direct terminal/curl/unix-pipe use, not for agents (agents should consume the JSON).formatjsonapplication/jsontexttext/plain(ASCII table)csvtext/csv(RFC 4180)tsvtext/tab-separated-valuesUnknown/absent
formatfalls back to JSON./helpand the README document it; the README's stale flatResponse Formatexample is corrected to the real script envelope.Depends on
0xeb/libxsql#4 (adds
script_result_to_csv/tsv). For sibling-checkout builds it's already available; for FetchContent (GIT_TAG main) builds, merge the libxsql PR first.Tested (live, against /usr/bin/cpio)
?format=text|csv|tsv→ correct body + Content-Type.'a,b'→"a,b",'he said "hi"'→"he said ""hi""", NULL → empty field./helplists the option.