Skip to content

Commit 935d16f

Browse files
committed
fix: expect content api url as baseurl
1 parent f20fd14 commit 935d16f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/http/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class HttpClient {
6262
setBaseURL(url: string): this {
6363
this._urlValidator.validate(url);
6464

65-
this._baseURL = `${url}/api`;
65+
this._baseURL = url;
6666

6767
return this;
6868
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { StrapiSDKConfig } from './sdk';
1212
* request dispatch, and response parsing for content management.
1313
*
1414
* @param config - The configuration for initializing the SDK. This should include the base URL
15-
* of the Strapi backend instance that the SDK communicates with. The baseURL
15+
* of the Strapi content API that the SDK communicates with. The baseURL
1616
* must be formatted with one of the supported protocols: `http` or `https`.
1717
* Additionally, optional authentication details can be specified within the config.
1818
*

src/sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class StrapiSDK<const T_Config extends StrapiSDKConfig = StrapiSDKConfig>
160160
* const sdk = createStrapiSDK({ baseURL: 'http://localhost:1337' );
161161
*
162162
* // Perform a custom fetch query
163-
* const response = await sdk.fetch('/api/categories');
163+
* const response = await sdk.fetch('/categories');
164164
*
165165
* // Parse the categories into a readable JSON object
166166
* const categories = await response.json();

tests/unit/http/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('HttpClient', () => {
4747

4848
// Assert
4949
expect(spy).toHaveBeenCalledWith(newBaseURL);
50-
expect(httpClient.baseURL).toBe(`${newBaseURL}/api`);
50+
expect(httpClient.baseURL).toBe(newBaseURL);
5151
});
5252

5353
it('setAuthStrategy should configure the authentication strategy', () => {

0 commit comments

Comments
 (0)