Crystal: Unhandled exception on HTTP::Handler

Created on 29 Oct 2019  路  3Comments  路  Source: crystal-lang/crystal

Seems a missing media type is caused unhandled exception in MIME

Unhandled exception on HTTP::Handler

Parsing error: Missing media type ("") (MIME::Error)

  from /usr/share/crystal/src/mime/media_type.cr:228:19 in 'parse'

  from /usr/share/crystal/src/http/client/response.cr:67:7 in '->'

  from /usr/share/crystal/src/http/server/request_processor.cr:255:3 in 'process'

  from /usr/share/crystal/src/fiber.cr:255:3 in 'run'

  from ???
bug topicnetworking

Most helpful comment

Bonus point if fixed using String#presence at HTTP::Client::Response#mime_type ?

All 3 comments

Bonus point if fixed using String#presence at HTTP::Client::Response#mime_type ?

I assume you're asking for the MIME type of the empty string?

@rdp nope, it's a HTTP::Client::Response which comes back with empty Content-Type header - see the stack trace (@bararchy, please correct me if I'm wrong).

Was this page helpful?
0 / 5 - 0 ratings