Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/request / src / deps / autoFixParams.ts
Size: Mime:
import { OneRequestStore } from '../typings'

const fromValueToFixed = (value: any) =>
  value === undefined || value === null ? '' : value

/**
 * @note currently only changing 1 level of params
 */
export function autoFixParams(store: OneRequestStore): void {
  if (store.has('params') === false) {
    return
  }

  const params = store.get('params')
  const clonedParams = {}
  Object.keys(params).forEach(key => {
    const value = params[key]
    clonedParams[key] = fromValueToFixed(value)
  })
  store.set('params', clonedParams)
}