Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.
This repository was archived by the owner on May 27, 2021. It is now read-only.

Could not satisfy the request's Accept header #8

@RangerRick

Description

@RangerRick

I have an Ionic app which consumes a large number of XML ReST requests using Basic Authorization.

If you override Angular's default HTTP service to use an alternate default 'Accept' header, $ionicUser.identify() fails with the following response:

{
    "config": {
        "data": {
            "_id": "XXXX",
            "device": {
                "screen_height": 1334,
                "screen_width": 750
            },
            "is_on_device": true,
            "user_id": "XXXX"
        },
        "headers": {
            "Accept": "application/xml",
            "Authorization": "Basic YYYY",
            "Content-Type": "application/json;charset=utf-8"
        },
        "method": "POST",
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "url": "https://apps.ionic.io/api/v1/app/XXXX/users/identify"
    },
    "data": {
        "detail": "Could not satisfy the request's Accept header"
    },
    "status": 406,
    "statusText": "NOT ACCEPTABLE"
}

$ionicUser (and potentially other apps.ionic.io tools) should probably explicitly ask for the Accepts: header it expects when making API calls.

As a workaround, I have changed my code to not override the default Accept: header and instead set it per-request, for now.

Metadata

Metadata

Assignees

No one assigned

    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