import { isRedirect, STATUS_UNAUTHORIZED } from '../constants.js';
/**
 * Process the response and determine the next action
 */
export function processResponse(context) {
    const { status, followRedirects, auth, aborted } = context;
    if (aborted) {
        return { shouldContinue: false, action: 'abort' };
    }
    // Handle redirects
    if (isRedirect(status)) {
        if (followRedirects) {
            return { shouldContinue: false, action: 'redirect', data: { status } };
        }
    }
    // Handle authentication challenges
    if (status === STATUS_UNAUTHORIZED && auth) {
        if (auth.method === 'ntlm') {
            return { shouldContinue: false, action: 'auth', data: { method: 'ntlm' } };
        }
    }
    // Normal response - publish it
    return { shouldContinue: false, action: 'publish' };
}
//# sourceMappingURL=ResponseProcessor.js.map