• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

decentraland / catalyst-client / 15532307765

09 Jun 2025 10:21AM UTC coverage: 69.624%. Remained the same
15532307765

push

github

web-flow
fix: query-params handling at fetcher when formatting URLs (#478)

148 of 226 branches covered (65.49%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

315 of 439 relevant lines covered (71.75%)

18.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/src/client/utils/fetcher.ts
1
import { IFetchComponent } from '@well-known-components/interfaces'
2

3
type Context = {
4
  url: string
5
  method: 'get' | 'post' | 'put' | 'delete' | 'patch'
6
  params?: any
7
  data?: any
8
  responseType?: string
9
  headers?: Record<string, string>
10
}
11

12
export type CustomClient<T> = (baseUrl: string, fetch: IFetchComponent) => Promise<T>
13

14
// NOTE: used by orval generator
15
export const useCustomClient = <T>({ url, method, params, data, headers }: Context): CustomClient<T> => {
2✔
16
  const relPath = url.substring('/lambdas'.length + 1)
×
17
  return async function (baseUrl: string, fetch: IFetchComponent): Promise<T> {
×
NEW
18
    const response = await fetch.fetch(`${baseUrl}/${relPath}?` + new URLSearchParams(params), {
×
19
      method,
20
      headers,
21
      ...(data ? { body: JSON.stringify(data) } : {})
×
22
    })
23

24
    return response.json()
×
25
  }
26
}
27

28
export default useCustomClient
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc