Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Documentation: Clarify paramsSerializer Usage with serialize and encode Fields #195

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ assets/sponsors/opencollective
*.css.map
# Local Netlify folder
.netlify

# intelij
.idea/
14 changes: 11 additions & 3 deletions posts/ar/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ These are the available config options for making requests. Only the `url` is re
ID: 12345
},

// `paramsSerializer` is an optional function in charge of serializing `params`
// `paramsSerializer` is a field for setting the serialization of `params`.
// You can use the serialize field to use a custom serialization function.
// You can use the encode field to use a custom encoding function.
// If you set a function to `paramsSerializer` as before, the default encoding function from axios will be assigned to the encode field.
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` is the data to be sent as the request body
Expand Down
15 changes: 11 additions & 4 deletions posts/de/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ Dies sind die verfügbaren Konfigurationsoptionen für HTTP-Anfragen. Nur das Fe
ID: 12345
},

// Mit `paramsSerializer` kann optional die Funktion zur Serialisierung des
// Feldes `params` manuell überschrieben werden.
// `paramsSerializer` ist ein Feld zum Festlegen der Serialisierung von `params`.
// Über das Feld serialize kann eine benutzerdefinierte Serialisierungsfunktion verwendet werden.
// Über das Feld encode kann eine benutzerdefinierte Kodierungsfunktion verwendet werden.
// Wenn Sie wie zuvor eine Funktion auf `paramsSerializer` setzen, wird die Standard-Kodierungsfunktion von axios dem Feld encode zugewiesen.
// (z.B. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` beinhaltet die Daten, die im Körper der Anfrage übertragen werden sollen.
Expand Down
14 changes: 11 additions & 3 deletions posts/en/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ These are the available config options for making requests. Only the `url` is re
ID: 12345
},

// `paramsSerializer` is an optional function in charge of serializing `params`
// `paramsSerializer` is a field for setting the serialization of `params`.
// You can use the serialize field to use a custom serialization function.
// You can use the encode field to use a custom encoding function.
// If you set a function to `paramsSerializer` as before, the default encoding function from axios will be assigned to the encode field.
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` is the data to be sent as the request body
Expand Down
16 changes: 12 additions & 4 deletions posts/es/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,19 @@ Estas son las opciones de configuración disponibles para hacer peticiones. Solo
ID: 12345
},

// `paramsSerializer` es una funcion opcional a cargo de serializar `params`
// `paramsSerializer` es un campo para configurar la serialización de `params`.
// Puedes usar el campo serialize para utilizar una función de serialización personalizada.
// Puedes usar el campo encode para utilizar una función de codificación personalizada.
// Si estableces una función en `paramsSerializer` como antes, la función de codificación predeterminada de axios se asignará al campo encode.
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` es el data a ser enviado como el cuerpo de la petición
// Solo aplicable a los métodos de petición 'PUT', 'POST', 'DELETE , y 'PATCH'
Expand Down
14 changes: 11 additions & 3 deletions posts/fa/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ next_link: '/docs/res_schema'
ID: 12345
},

// `paramsSerializer` یک عملکرد اختیاری است که وظیفه سریال سازی `params` را بر عهده دارد
// `paramsSerializer` یک فیلد برای تنظیم سریال‌سازی `params` است.
// می‌توانید از فیلد serialize برای استفاده از یک تابع سریال‌سازی سفارشی استفاده کنید.
// می‌توانید از فیلد encode برای استفاده از یک تابع رمزگذاری سفارشی استفاده کنید.
// اگر همانند قبل تابعی به `paramsSerializer` تنظیم کنید، تابع رمزگذاری پیش‌فرض axios به فیلد encode اختصاص داده می‌شود.
// (به عنوان مثال، https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` داده ای است که به عنوان بدنه درخواست ارسال می شود
Expand Down
14 changes: 11 additions & 3 deletions posts/fr/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ Voici les différentes options de configuration que vous pouvez utiliser pour fa
ID: 12345
},

// `paramsSerializer` est une fonction optionnelle qui permet de définir
// `paramsSerializer` est un champ pour définir la sérialisation de `params`.
// Vous pouvez utiliser le champ serialize pour utiliser une fonction de sérialisation personnalisée.
// Vous pouvez utiliser le champ encode pour utiliser une fonction de codage personnalisée.
// Si vous définissez une fonction sur `paramsSerializer` comme auparavant, la fonction de codage par défaut d'axios sera attribuée au champ encode.
// comment `params` doit être sérialisé (avec https://www.npmjs.com/package/qs
// ou http://api.jquery.com/jquery.param/ par exemple).
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` correspond aux données qui constitueront le corps de la requête.
Expand Down
14 changes: 11 additions & 3 deletions posts/ja/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ next_link: '/docs/res_schema'
ID: 12345
},

// `paramsSerializer` は、 `params` のシリアライズを担当するオプションの関数です。
// `paramsSerializer`は、`params`のシリアル化を設定するフィールドです。
// serializeフィールドを使用して、カスタムシリアル化関数を使用できます。
// encodeフィールドを使用して、カスタムエンコーディング関数を使用できます。
// 以前のように`paramsSerializer`に関数を設定すると、axiosのデフォルトエンコーディング関数がencodeフィールドに割り当てられます。
// (たとえば、https://www.npmjs.com/package/qs、http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` はリクエスト ボディとして送信されるデータです。
Expand Down
14 changes: 11 additions & 3 deletions posts/kr/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ next_link: '/kr/docs/res_schema'
ID: 12345
},

// `paramsSerializer`는 `params`의 시리얼라이즈를 담당하는 옵션 함수입니다.
// `paramsSerializer`는 `params`의 시리얼라이즈를 설정하는 필드입니다.
// serialize 필드를 통해 사용자 정의 시리얼라이즈 함수를 사용할 수 있습니다.
// encode 필드를 통해 사용자 정의 인코딩 함수를 사용할 수 있습니다.
// 이전처럼 `paramsSerializer`에 함수를 설정하면 encode 필드에 axios에서 사용하는 기본 인코딩 함수가 할당됩니다.
// (예: https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data`는 요청 바디로 전송될 데이터입니다.
Expand Down
14 changes: 11 additions & 3 deletions posts/ku/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@ next_link: "/ku/docs/res_schema"
ID: 12345
},

// ـەکان`params` کردنی serializing فەنکشنێکی بژاردەییە بەرپرسە لە
// `paramsSerializer` بەشێکە بۆ دانانی سریالکەرەوەی `params`.
// دەتوانی بەشە serialize بەکاربهێنی بۆ بەکارھێنانی فەرمی سریالکەرەوەی خۆی.
// دەتوانی بەشە encode بەکاربهێنی بۆ بەکارھێنانی فەرمی کۆدکردنی خۆی.
// ئەگەر پێشتر وەکوو پێشتر فەرمی بۆ `paramsSerializer` دانیت، فەرمی بنەڕەتی کۆدکردنی axios بەپێی encode بەشەکە دەکرێتەوە.
// (https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/ نموونە)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// بریتییە لەو داتاییە کە دەنێردرێت وەکو لاشەی داواکارییەکە `data`
Expand Down
14 changes: 11 additions & 3 deletions posts/ptBR/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ Estas são as configurações opcionais disponíveis para fazer uma requisição
ID: 12345
},

// `paramsSerializer` é uma função opcional que comanda a serialização dos `params`
// `paramsSerializer` é um campo para definir a serialização de `params`.
// Você pode usar o campo serialize para usar uma função de serialização personalizada.
// Você pode usar o campo encode para usar uma função de codificação personalizada.
// Se você definir uma função em `paramsSerializer` como antes, a função de codificação padrão do axios será atribuída ao campo encode.
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` são os dados a serem enviados no corpo da requisição
Expand Down
16 changes: 12 additions & 4 deletions posts/ru/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,18 @@ next_link: '/docs/res_schema'
ID: 12345
},

// `paramsSerializer` это дополнительная функция, отвечающая за сериализацию `params`
// (например https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
// `paramsSerializer` - это поле для настройки сериализации `params`.
// Вы можете использовать поле serialize для использования пользовательской функции сериализации.
// Вы можете использовать поле encode для использования пользовательской функции кодирования.
// Если вы зададите функцию для `paramsSerializer` как раньше, то функция кодирования по умолчанию из axios будет назначена полю encode.
// (например https://www.npmjs.com/package/qs, https://api.jquery.com/jquery.param/)
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` - это данные, которые посылаются как тело запроса
Expand Down
14 changes: 11 additions & 3 deletions posts/tr/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ Bunlar, istek yapmak için mevcut konfigürasyon seçenekleridir. Yalnızca `url
ID: 12345
},

// `paramsSerializer`, `params`ın dizileştirilmesinden (serialize) sorumlu isteğe bağlı bir işlevdir
// `paramsSerializer`, `params`ın serileştirilmesi için bir alandır.
// serialize alanını kullanarak özel bir serileştirme işlevi kullanabilirsiniz.
// encode alanını kullanarak özel bir kodlama işlevi kullanabilirsiniz.
// Daha önce olduğu gibi `paramsSerializer`a bir işlev ayarlarsanız, axios'un varsayılan kodlama işlevi encode alanına atanacaktır.
// (örneğin: https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` istek gövdesi olarak gönderilecek veridir
Expand Down
16 changes: 12 additions & 4 deletions posts/uk/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ next_link: '/uk/docs/res_schema'
ID: 12345
},

// `paramsSerializer` - це додаткова функція, яка відповідає за серіалізацію` params`
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
// `paramsSerializer` - це поле для налаштування серіалізації `params`.
// Ви можете використовувати поле serialize для використання власної функції серіалізації.
// Ви можете використовувати поле encode для використання власної функції кодування.
// Якщо ви, як і раніше, задасте функцію в `paramsSerializer`, за замовчуванням функція кодування з axios буде призначена полю encode.
// (e.g. https://www.npmjs.com/package/qs, https://api.jquery.com/jquery.param/)
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` - це дані, які надсилаються як тіло запиту
Expand Down
14 changes: 11 additions & 3 deletions posts/vi/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ next_link: '/vi/docs/res_schema'
ID: 12345
},

// `paramsSerializer` là hàm tùy chọn để đảm nhiệm tuần tự hóa `params`.
// `paramsSerializer` là một trường để thiết lập tuần tự hóa của `params`.
// Bạn có thể sử dụng trường serialize để sử dụng một hàm tuần tự hóa tùy chỉnh.
// Bạn có thể sử dụng trường encode để sử dụng một hàm mã hóa tùy chỉnh.
// Nếu bạn thiết lập một hàm vào `paramsSerializer` như trước đây, hàm mã hóa mặc định từ axios sẽ được gán vào trường encode.
// (vd https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` là dữ liệu làm phần thân request để được gửi đi.
Expand Down
18 changes: 13 additions & 5 deletions posts/zh/req_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,19 @@ next_link: '/zh/docs/res_schema'
params: {
ID: 12345
},

// `paramsSerializer`是可选方法,主要用于序列化`params`
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})

// `paramsSerializer` 是一个用于设置 `params` 序列化的字段。
// 你可以通过 serialize 字段来使用自定义的序列化函数。
// 你可以通过 encode 字段来使用自定义的编码函数。
// 如果像以前一样在 `paramsSerializer` 中设置一个函数,axios 的默认编码函数将被分配给 encode 字段。
// (e.g. https://www.npmjs.com/package/qs, https://api.jquery.com/jquery.param/)
paramsSerializer: {
serialize: (params) => {
return Qs.stringify(params, {arrayFormat: 'brackets'})
},
encode: (str) => {
return encodeURIComponent(str)
}
},

// `data` 是作为请求体被发送的数据
Expand Down