Skip to content

Commit

Permalink
fix(browser): use auth mode in query string in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Feb 2, 2021
1 parent 74972a1 commit 0fa6ec5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/algoliasearch/src/builds/browser.ts
Expand Up @@ -17,7 +17,7 @@ import {
stopABTest,
StopABTestResponse,
} from '@algolia/client-analytics';
import { version, WaitablePromise } from '@algolia/client-common';
import { AuthMode, version, WaitablePromise } from '@algolia/client-common';
import {
createRecommendationClient,
getPersonalizationStrategy,
Expand Down Expand Up @@ -201,6 +201,7 @@ export default function algoliasearch(
],
}),
userAgent: createUserAgent(version).add({ segment: 'Browser' }),
authMode: AuthMode.WithinQueryParameters,
};

return createSearchClient({
Expand Down
8 changes: 5 additions & 3 deletions packages/client-common/src/types/AuthModeType.ts
@@ -1,4 +1,6 @@
export const AuthMode: Readonly<Record<string, AuthModeType>> = {
// @MAJOR: export this as individual constants, so it can be minified

export const AuthMode = {
/**
* If auth credentials should be in query parameters.
*/
Expand All @@ -8,6 +10,6 @@ export const AuthMode: Readonly<Record<string, AuthModeType>> = {
* If auth credentials should be in headers.
*/
WithinHeaders: 1,
};
} as const;

export type AuthModeType = 0 | 1;
export type AuthModeType = typeof AuthMode[keyof typeof AuthMode];
8 changes: 5 additions & 3 deletions packages/transporter/src/types/CallType.ts
@@ -1,4 +1,6 @@
export const CallEnum: Readonly<Record<string, CallType>> = {
// @MAJOR: export this as individual constants, so it can be minified

export const CallEnum = {
/**
* If the host is read only.
*/
Expand All @@ -13,6 +15,6 @@ export const CallEnum: Readonly<Record<string, CallType>> = {
* If the host is both read and write.
*/
Any: 3,
};
} as const;

export type CallType = 1 | 2 | 3;
export type CallType = typeof CallEnum[keyof typeof CallEnum];

0 comments on commit 0fa6ec5

Please sign in to comment.