axios-case-converter

Axios transformer/interceptor that converts snake_case/camelCase

MIT License

Stars
160
Committers
8
axios-case-converter - v1.1.1 Latest Release

Published by mpyw 9 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/mpyw/axios-case-converter/compare/v1.1.0...v1.1.1

axios-case-converter - v1.1.2

Published by mpyw 9 months ago

What's Changed

Full Changelog: https://github.com/mpyw/axios-case-converter/compare/v1.1.1...v1.1.2

axios-case-converter - v1.1.1

Published by mpyw 10 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/mpyw/axios-case-converter/compare/v1.1.0...v1.1.1

axios-case-converter - v1.1.0

Published by mpyw over 1 year ago

axios-case-converter - v0.11.1

Published by mpyw about 2 years ago

axios-case-converter - v0.11.0

Published by mpyw about 2 years ago

axios-case-converter - v0.10.0

Published by mpyw about 2 years ago

馃ぎ Fix axios and axios-mock-adapter compatibility issue on tests 馃ぎ by mpyw 路 Pull Request #48 路 mpyw/axios-case-converter

The two critical problems are:

  • The value returned from axios-mock-adapter mock definitions must be an AxiosHeaders object, otherwise the instance reference will be changed.
  • axios does not expose AxiosHeaders constructor.

While not a bug, axios@v1 still has a problem for testability. In this PR, I managed to get the test passed via dirty hacks.

Although #47 was not a bug, still there are problems.

axios-case-converter - v0.10.0-alpha.1

Published by mpyw about 2 years ago

feat!: Support Axios v1 by siketyan 路 Pull Request #46 路 mpyw/axios-case-converter

Warning BREAKING CHANGE: CreateAxiosRequestTransformer now must return AxiosRequestTransformer instead of AxiosResponseTransformer.

Also please have a look at the following issue:

axios v1.x bug: response header mutations via transformResponse are discarded 路 Issue #47 路 mpyw/axios-case-converter

axios-case-converter - v0.9.0

Published by mpyw about 3 years ago

axios-case-converter - v0.8.0

Published by mpyw over 3 years ago

axios-case-converter -

Published by mpyw almost 4 years ago

axios-case-converter - v0.6.0

Published by mpyw over 4 years ago

axios-case-converter - v0.6.0-beta.1

Published by mpyw over 4 years ago

[BC] Major Refactoring by mpyw 路 Pull Request #26 路 mpyw/axios-case-converter

Resolves #23.

Breaking Changes

Renamed Options

  • converters.snakeRequest -> caseMiddleware.requestTransformer
  • converters.camelResponse -> caseMiddleware.responseTransformer
  • converters.snakeParams -> caseMiddleware.requestInterceptor

Renamed Files

  • transform.ts -> transformers.ts
  • index.ts -> middleware.ts and index.ts

Renamed or Removed Exports

  • The following exports in index.ts are renamed or removed. Please export them from middleware.ts instead, using their new names.
    • snakeParams -> REMOVED
    • snakeRequest -> REMOVED
    • camelResponse -> REMOVED
    • createSnakeParams -> createSnakeParamsInterceptor in middleware.ts
    • createSnakeRequest -> createSnakeRequestTransformer in middleware.ts
    • createCamelResponse -> createCamelResponseTransformer in middleware.ts
  • The following exports intransformers.ts are renamed or removed.
    • default -> REMOVED
    • snake -> REMOVED
    • camel -> REMOVED
    • header -> REMOVED
    • createTransform -> createObjectTransformer
    • createTransformOf -> createObjectTransformerOf
    • createTransforms -> createObjectTransformers
  • The following exports indecorators.ts are removed.
    • preserveArrayBrackets -> REMOVED

Renamed, Removed or Changed Types

String Transformer Related

  • Transformer -> CaseFunction
  • Transformers -> CaseFunctions
    • Transformers entries are previously all optional, but CaseFunctions ones are all required.
    • Partial<CaseFunctions> is currently used instead of previous Transformers.

Object Transformer Related

  • TransformOptions -> ObjectTransformerOptions
  • TransformUsingCallback -> REMOVED
  • Transform -> ObjectTransformer
  • CreateTransform -> CreateObjectTransformer
  • CreateTransformOf -> CreateObjectTransformerOf
  • CreateTransforms -> CreateObjectTransformers

Axios Case Middleware Related

  • ConverterOptions -> AxiosCaseMiddlewareOptions
  • ApplyConvertersOptions -> ApplyCaseMiddlewareOptions

New Features

caseOptions options

By default, { stripRegexp: /[^A-Z0-9[\]]+/gi } is used as default change-case function options. This preserves [] chars in object keys. If you wish keeping original change-case behavior, override the options.

Fixed Bugs

  • Prevent infinite loop when overwriting iterables
  • Prevent duplicate entries
axios-case-converter - v0.4.1

Published by mpyw over 4 years ago

axios-case-converter - v0.4.0

Published by mpyw over 4 years ago

Huge Refactoring by mpyw 路 Pull Request #18 路 mpyw/axios-case-converter

Overview

  • Rewrite in TypeScript
  • Add new feature: Exclude specific keys from automatic key conversion
  • Add new feature: Customize transformer functions