import { parseEndpoint } from './parse_endpoint' ; export function formatRequest ( endpoint , pathParams = { } ) { const { method , pathname : rawPathname } = parseEndpoint ( endpoint ) ; const pathname = Object . keys ( pathParams ) . reduce ( ( acc , paramName ) => { return acc . replace ( `{${ paramName }}` , pathParams [ paramName ] ) ; } , rawPathname ) ; return { method , pathname } ; }