datasette --get --token option, closes #1946, refs #1855

This commit is contained in:
Simon Willison 2022-12-12 20:36:42 -08:00
commit c13dada2f8
3 changed files with 43 additions and 1 deletions

View file

@ -122,6 +122,7 @@ Once started you can access it at ``http://localhost:8001``
the root user
--get TEXT Run an HTTP GET request against this path,
print results and exit
--token TEXT API token to send with --get requests
--version-note TEXT Additional note to show on /-/versions
--help-settings Show available settings
--pdb Launch debugger on any errors
@ -189,6 +190,8 @@ For example::
}
}
You can use the ``--token TOKEN`` option to send an :ref:`API token <CreateTokenView>` with the simulated request.
The exit code will be 0 if the request succeeds and 1 if the request produced an HTTP status code other than 200 - e.g. a 404 or 500 error.
This lets you use ``datasette --get /`` to run tests against a Datasette application in a continuous integration environment such as GitHub Actions.