Skip to content

Commit 08e4cf8

Browse files
committed
🐛 fix: switch open cep base url to static
1 parent 91dd990 commit 08e4cf8

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/clients/opencep/open-cep-api-client-impl.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('client open-cep', () => {
3030

3131
vi.stubGlobal('fetch', mockedFetch)
3232

33-
const client = new OpenCepAPIClientImpl('https://opencep.com')
33+
const client = new OpenCepAPIClientImpl()
3434

3535
const result = await client.getCep('12345678')
3636

@@ -46,7 +46,7 @@ describe('client open-cep', () => {
4646

4747
vi.stubGlobal('fetch', mockedFetch)
4848

49-
const client = new OpenCepAPIClientImpl('https://opencep.com')
49+
const client = new OpenCepAPIClientImpl()
5050
await client.getCep('12345678')
5151
expect(mockedWarnLogger).toBeCalledWith({ message: 'Network Error' })
5252
})

src/clients/opencep/open-cep-api-client-impl.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ import type { OpenCepAPIClient } from './open-cep-api-client'
33
import type { OpenCepResponse } from './types'
44

55
export class OpenCepAPIClientImpl implements OpenCepAPIClient {
6-
constructor(private readonly apiURL: string) {}
7-
86
async getCep(cep: string): Promise<OpenCepResponse | undefined> {
97
Logger.info(`Starting getCep [cep=${cep}]`)
10-
return fetch(`${this.apiURL}/v1/${cep}.json`)
8+
return fetch(`https://opencep.com/v1/${cep}.json`)
119
.then((response) => response.json())
1210
.catch((error) => {
1311
Logger.warn(error)

0 commit comments

Comments
 (0)