Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

HTTP::Error Unknown MIME type: text/html #18

@tak1n

Description

@tak1n

When API.ai does not respond with json calling #parse on a HTTP response raises an exception as no other Mime Type handler is registered yet. (HTTP implements json handler as default: https://github.com/httprb/http/blob/master/lib/http/mime_type/json.rb)

This problem mostly occurrs when API.ai is down (so should not be a big deal as I hope it is not that often down :D), but still it would be helpful to have a more intuitive exception raised.
Further down in apiai-ruby-cllient the problem is that fail_or_return_response_body(response.code, response_body) already takes the parsed response as argument.

apiai-ruby-client should probably only call #parse if it knows it's a json response.

Is this anything we should improve? If yes I will try to create a pr for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions