From ae003913a39f3bdf9bbbd8f71a1ed681fd044d8b Mon Sep 17 00:00:00 2001 From: David Dallas <110460234+DavidJDallas@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:59:17 +0100 Subject: [PATCH] docs(paramsSerializer config within request config): update documentation for paramsSerializer Co-authored-by: David Dallas Co-authored-by: Jay --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5c7a23e..2227252 100644 --- a/README.md +++ b/README.md @@ -384,12 +384,18 @@ These are the available config options for making requests. Only the `url` is re params: { ID: 12345 }, - - // `paramsSerializer` is an optional config in charge of serializing `params` + + // `paramsSerializer` is an optional config that allows you to customize serializing `params`. paramsSerializer: { - encode?: (param: string): string => { /* Do custom ops here and return transformed string */ }, // custom encoder function; sends Key/Values in an iterative fashion - serialize?: (params: Record, options?: ParamsSerializerOptions ), // mimic pre 1.x behavior and send entire params object to a custom serializer func. Allows consumer to control how params are serialized. - indexes: false // array indexes format (null - no brackets, false (default) - empty brackets, true - brackets with indexes) + + //Custom encoder function which sends key/value pairs in an iterative fashion. + encode?: (param: string): string => { /* Do custom operations here and return transformed string */ }, + + // Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour. + serialize?: (params: Record, options?: ParamsSerializerOptions ), + + //Configuration for formatting array indexes in the params. + indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes). }, // `data` is the data to be sent as the request body