Skip to content
This repository was archived by the owner on Jul 30, 2018. It is now read-only.
This repository was archived by the owner on Jul 30, 2018. It is now read-only.

Not an issue, question about request and querystrings #167

Description

@sebilasse

Hey,
currently writing an "auth" module using core/request and wonder if the parsing of querystrings could go to the request module as a responseType because I think it is common (?) :

import { UrlSearchParams } from '../../core/src/main';

/**
 * Add a filter that automatically parses incoming querystrings.
 */
filterRegistry.register(
    function (response: Response<any>, url: string, options: RequestOptions) {
        return typeof response.data && options && options.responseType === 'querystring';
    },
    function (response: Response<any>, url: string, options: RequestOptions): Object {
        return {
                data: (new Parameters(String(response.data))).get()
            };
    }
);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions