diff --git a/docs/api.rst b/docs/api.rst index 0e6e57b..2998b9d 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -20,13 +20,13 @@ The UTF-8 encoded string you want to paste. ``lexer`` (optional) ~~~~~~~~~~~~~~~~~~~~ -Can also be set via GET. The lexer string key used for highlighting. -See `lexer list`_ for a full list of choices. Default: ``python``. +The lexer string key used for highlighting. See `lexer list`_ for a full list +of choices. Default: ``python``. ``format`` (optional) ~~~~~~~~~~~~~~~~~~~~~ -Can also be set via GET. The format of the API response. Choices are: +The format of the API response. Choices are: * ``default`` — Returns a full qualified URL wrapped in quotes. Example:: @@ -51,10 +51,10 @@ Can also be set via GET. The format of the API response. Choices are: ``expires`` (optional) ~~~~~~~~~~~~~~~~~~~~~~ -Can also be set via GET. A keyword to indicate the lifetime of a -snippetn in seconds. The values are predefined by the server. Calling this with -an invalid value returns a HTTP 400 BadRequest together with a list of valid -values. Default: ``2592000``. In the default configuration valid values are: +A keyword to indicate the lifetime of a snippetn in seconds. The values are +predefined by the server. Calling this with an invalid value returns a HTTP 400 +BadRequest together with a list of valid values. Default: ``2592000``. In the +default configuration valid values are: * onetime * never @@ -65,10 +65,9 @@ values. Default: ``2592000``. In the default configuration valid values are: ``filename`` (optional) ~~~~~~~~~~~~~~~~~~~~~~~ -Can also be set via GET. A filename which we use to determine a lexer, if -``lexer`` is not set. In case we can't determine a file, the lexer will fallback -to ``plain`` code (no highlighting). A given ``lexer`` will overwrite any -filename! Example:: +A filename which we use to determine a lexer, if ``lexer`` is not set. In case +we can't determine a file, the lexer will fallback to ``plain`` code (no +highlighting). A given ``lexer`` will overwrite any filename! Example:: { "url": "https://dpaste.de/xsWd", diff --git a/dpaste/views.py b/dpaste/views.py index 820edaa..e1e6fb0 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -296,10 +296,10 @@ FORMAT_MAPPING = { @csrf_exempt def snippet_api(request): content = request.POST.get('content', '').strip() - lexer = request.REQUEST.get('lexer', LEXER_DEFAULT).strip() - filename = request.REQUEST.get('filename', '').strip() - expires = request.REQUEST.get('expires', '').strip() - format = request.REQUEST.get('format', 'default').strip() + lexer = request.POST.get('lexer', LEXER_DEFAULT).strip() + filename = request.POST.get('filename', '').strip() + expires = request.POST.get('expires', '').strip() + format = request.POST.get('format', 'default').strip() if not content: return HttpResponseBadRequest('No content given')