@@ -11,7 +11,7 @@ import MeiliSearchError from './errors/meilisearch-error'
1111import MeiliSearchTimeOutError from './errors/meilisearch-timeout-error'
1212import MeiliAxiosWrapper from './meili-axios-wrapper'
1313import * as Types from './types'
14- import { sleep } from './utils'
14+ import { sleep , removeUndefinedFromObject } from './utils'
1515
1616class Index < T > extends MeiliAxiosWrapper implements Types . IndexInterface < T > {
1717 uid : string
@@ -93,7 +93,7 @@ class Index<T> extends MeiliAxiosWrapper implements Types.IndexInterface<T> {
9393 attributesToHighlight : options ?. attributesToHighlight ,
9494 }
9595 if ( method . toUpperCase ( ) === 'POST' ) {
96- return await this . post ( url , params , {
96+ return await this . post ( url , removeUndefinedFromObject ( params ) , {
9797 cancelToken : this . cancelTokenSource . token ,
9898 } )
9999 } else if ( method . toUpperCase ( ) === 'GET' ) {
@@ -118,7 +118,7 @@ class Index<T> extends MeiliAxiosWrapper implements Types.IndexInterface<T> {
118118 }
119119
120120 return await this . get ( url , {
121- params : getParams ,
121+ params : removeUndefinedFromObject ( getParams ) ,
122122 cancelToken : this . cancelTokenSource . token ,
123123 } )
124124 } else {
0 commit comments