1# Common Library Subsystem Changelog 2 3Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(MR) has the following API changes in the URL module of the common library subsystem. 4 5## cl.commonlibrary.1 URLParams Class Changes 6 7The constructor function of the **URLParams** class in the URL module of the common library subsystem is changed. 8 9Specifically, **constructor(init?: string[][] | Record<string, string> | string | URLSearchParams)** is changed to **constructor(init?: string[][] | Record<string, string> | string | URLParams)**, and the parameter type is changed from **URLSearchParams** to **URLParams**. 10 11You need to adapt your application. 12 13**Change Impacts** 14 15JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version. 16 17**Key API/Component Changes** 18 19| Module | Class | Method/Attribute/Enum/Constant | Change Type| 20| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- | 21| @ohos.url | URLParams | constructor(string[][] \| Record<string, string> \| string \| URLSearchParams) | Deleted | 22| @ohos.url | URLParams | constructor(string[][] \| Record<string, string> \| string \| URLParams)| Changed 23 24**Adaptation Guide** 25 26The following illustrates how to create a **URLParams** object in your application. 27 28Example: 29 30```ts 31import url from '@ohos.url' 32try { 33 let params1 = new Url.URLParams('?user=abc&query=xyz') 34 let params2 = new Url.URLParams(params1) 35 var result= params2.toString() 36 console.log(result) //"user=abc&query=xyz" 37} catch (err) { 38 console.error(`Fail to ceate URLParams.codeis${err.code},message is ${err.message}`); 39} 40``` 41## cl.commonlibrary.2 URL Attribute Changes of URLParams Class APIs 42 43The URL attributes of the URL module in the common library subsystem are changed. 44 45Specifically, the **searchParams: URLSearchParams** attribute is deprecated, and the **params: URLParams** attribute is added. 46 47You need to adapt your application. 48 49**Change Impacts** 50 51JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version. 52 53**Key API/Component Changes** 54 55| Module | Class | Method/Attribute/Enum/Constant | Change Type| 56| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- | 57| @ohos.url | URL | searchParams: URLSearchParams; |Deprecated (in API version 9)<br> | 58| @ohos.url | URL | params: URLParams; | Added | 59 60**Adaptation Guide** 61 62The following illustrates how to create a **URLParams** object in your application. 63 64Example: 65 66```ts 67import url from '@ohos.url' 68let that = new Url.URL('http://username:password@host:8080/directory/file?Hello=china#qwer=da') 69let params = that.URLParams 70var result = params.toString() 71console.log(result) //%E4%BD%A0%E5%A5%BD=china 72``` 73