Skip to content
Permalink
Browse files
fixed:consumer url unnecessary escape && and querystring test
  • Loading branch information
hufeng committed Aug 3, 2021
1 parent 220936a commit a7694f96d6c31765314820ec8c27a39df5ec5965
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import qs from 'querystring'

describe('qs test suite', () => {
it('test without default encoder', () => {
const str = qs.stringify(
{
application: 'test',
group: '',
version: '0.0.0',
methods: 'sayHello,sayWorld'
},
null,
null,
{ encodeURIComponent: (str) => str }
)

expect(str).toEqual(
'application=test&group=&version=0.0.0&methods=sayHello,sayWorld'
)
})
})
@@ -58,8 +58,8 @@ export default class DubboService {
private reject: Function
private readonly readyPromise: Promise<void>

private application: { name: string }
private dubbo: string
private readonly application: { name: string }
private readonly dubbo: string

private retry: Retry
private port: number
@@ -319,7 +319,10 @@ export default class DubboService {
params['version'] = version
}
return (
`dubbo://${ipAddr}:${this.port}/${dubboInterface}?` + qs.stringify(params)
`dubbo://${ipAddr}:${this.port}/${dubboInterface}?` +
qs.stringify(params, null, null, {
encodeURIComponent: (str) => str
})
)
}

0 comments on commit a7694f9

Please sign in to comment.