Rocket: text/csv is not recognized as a acceptable content type

Created on 27 Dec 2016  路  2Comments  路  Source: SergioBenitez/Rocket

Trying to use text/csv as the format on one of my handlers but I am getting the error below.

warning: 'text/csv' is not a known content-type
  --> src/main.rs:56:28
   |
56 | #[post("/upload", format = "text/csv", data = "<file>")]
   |                            ^^^^^^^^^^

error: `format` must be a "content/type"`
  --> src/main.rs:56:19
   |
56 | #[post("/upload", format = "text/csv", data = "<file>")]
   |                   ^^^^^^^^^^^^^^^^^^^
   |
   = help: format, if specified, must be a key-value pair where
              the key is `format` and the value is a string representing the
              content-type accepted. e.g: format = "application/json

Edit: Maybe in the documentation show the accepted format types.
Edit2: Workaround is to just use text/plain and just assume it is a csv.

accepted bug

All 2 comments

Confirmed. Rocket should warn on, but not deny, unknown content types. Further, RFC7111 declares the Content-Type for CSV files to be text/csv, so Rocket should know about it. Fixing now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lambda-fairy picture lambda-fairy  路  4Comments

marceloboeira picture marceloboeira  路  3Comments

sphinxc0re picture sphinxc0re  路  3Comments

klnusbaum picture klnusbaum  路  4Comments

haheute picture haheute  路  4Comments