Skip to content

HTTP calls incorrectly expected to return JSON #7

@walliski

Description

@walliski

https://github.com/djluck/azure-active-directory/blame/master/lib/serverHttp.js#L18

The response that you get from HTTP data contains the following attributes:

statusCode Number
    Numeric HTTP result status code, or null on error.
content String
    The body of the HTTP response as a string.
data Object or null
    If the response headers indicate JSON content, this contains the body of the document parsed as a
    JSON object.
headers Object
    A dictionary of HTTP headers from the response. 

When adding a resource for the Onenote API and try to get page content, the content is not returned as JSON, but as a string of HTML. This means that response.data is null and the request throws an exception. 🎉 TypeError: Cannot read property 'error' of null

https://docs.meteor.com/api/http.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions