src/index.js
function fixedSaveCookies(res) {
    const cookies = res.headers['set-cookie'];

    if (cookies) {
        const fixedCookies = cookies.reduce(
            (cookies, cookie) => cookies.concat(cookie.split(/,(?!\s)/)),
            []
        );
        this.jar.setCookies(fixedCookies);
    }
}
function fixedSaveCookies(res) {
    const cookies = res.headers['set-cookie'];

    if (cookies) {
        const fixedCookies = cookies.reduce(
            (cookies, cookie) => cookies.concat(cookie.split(/,(?!\s)/)),
            []
        );
        this.jar.setCookies(fixedCookies);
    }
}
function fixedSaveCookies ( res ) { const cookies = res . headers [ 'set-cookie' ] ; if ( cookies ) { const fixedCookies = cookies . reduce ( ( cookies , cookie ) => cookies . concat ( cookie . split ( / ,(?!\s) / ) ) , [ ] ) ; this . jar . setCookies ( fixedCookies ) ; } }
Fixes jest's set-cookie behavior. Jest normally sets the cookie as a single string instead of an array.
This function splits the string and transforms it into an array the way it should be.
@param {Response} res
@api private
Fixes jest s set - cookie behavior . Jest normally sets the cookie as a single string instead of an array . This function splits the string and transforms it into an array the way it should be .