* Fix case-insensitive pre-auth header check in doPing HTTP headers are case-insensitive per RFC 7230, but the pre-auth rejection check accessed x-reject-reason using an exact lowercase key. Servers/proxies may return varying cases (e.g. X-Reject-Reason). Add a getResponseHeader utility for case-insensitive lookup and use it in both pre-auth check paths. * Address PR feedback: optimize getResponseHeader and fix test description Try exact match and lowercase match before falling back to a full scan to avoid array allocation on every call. Fix test description to say "uppercase" instead of "mixed case" to match the test data.
18 lines
841 B
TypeScript
18 lines
841 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
export const HEADER_AUTH = 'Authorization';
|
|
export const HEADER_ACCEPT = 'Accept';
|
|
export const HEADER_ACCEPT_LANGUAGE = 'Accept-Language';
|
|
export const HEADER_BEARER = 'BEARER';
|
|
export const HEADER_CACHE_CONTROL = 'Cache-Control';
|
|
export const HEADER_REQUESTED_WITH = 'X-Requested-With';
|
|
export const HEADER_TOKEN = 'Token';
|
|
export const HEADER_USER_AGENT = 'User-Agent';
|
|
export const HEADER_X_CSRF_TOKEN = 'X-CSRF-Token';
|
|
export const HEADER_X_MATTERMOST_PREAUTH_SECRET = 'X-Mattermost-Preauth-Secret';
|
|
export const HEADER_X_REJECT_REASON = 'X-Reject-Reason';
|
|
export const HEADER_X_VERSION_ID = 'X-Version-Id';
|
|
export const DEFAULT_LIMIT_BEFORE = 30;
|
|
export const DEFAULT_LIMIT_AFTER = 30;
|
|
export const PER_PAGE_DEFAULT = 60;
|