File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,14 +49,15 @@ export const Utils = {
4949 } ,
5050 initOptions ( opts : UniversalApiOptions | undefined , config : ResolvedConfig ) : UniversalApiOptionsRequired {
5151 const fullFsDir = join ( config . root , opts ?. fsDir ?? "" ) ;
52+ const normalizePrefix = ( el : string ) : string => {
53+ let endpoint = Utils . request . addSlash ( el , "leading" ) ;
54+ endpoint = Utils . request . removeSlash ( endpoint , "trailing" ) ;
55+ return endpoint ;
56+ } ;
5257 const endpointPrefix = opts ?. endpointPrefix
5358 ? Array . isArray ( opts . endpointPrefix ) && opts . endpointPrefix . length > 0
54- ? opts . endpointPrefix . map ( el => {
55- let endpoint = Utils . request . addSlash ( el , "leading" ) ;
56- endpoint = Utils . request . removeSlash ( endpoint , "trailing" ) ;
57- return endpoint ;
58- } )
59- : Array . isArray ( opts . endpointPrefix ) ? opts . endpointPrefix : [ opts . endpointPrefix ]
59+ ? opts . endpointPrefix . map ( normalizePrefix )
60+ : Array . isArray ( opts . endpointPrefix ) ? opts . endpointPrefix : [ normalizePrefix ( opts . endpointPrefix ) ]
6061 : [ '/api' ] ;
6162 return {
6263 disable : opts ?. disable ?? false ,
You can’t perform that action at this time.
0 commit comments