UNPKG

@bytekit/autofetch

Version:

A TypeScript-first, decorator-based HTTP client for building elegant and modular API clients with fetch under the hood. Inspired by Spring's `@RestClient` and OpenFeign.

9 lines (8 loc) 406 B
import { ClientConstants } from "./constants.js"; const HeaderParam = (name) => (target, propertyKey, parameterIndex) => { const queryParams = Reflect.getMetadata(ClientConstants.HeaderParams, target, propertyKey) ?? new Map(); queryParams.set(parameterIndex, name); Reflect.defineMetadata(ClientConstants.HeaderParams, queryParams, target, propertyKey); }; export default HeaderParam;