Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 4fcca13

Browse files
committed
#272 Setting JSON UTF8 for JSON payloads
1 parent b760520 commit 4fcca13

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/main/java/com/marklogic/mgmt/ManageClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public void deleteAsSecurityUser(String path) {
319319
*/
320320
public HttpEntity<String> buildJsonEntity(String json) {
321321
HttpHeaders headers = new HttpHeaders();
322-
headers.setContentType(MediaType.APPLICATION_JSON);
322+
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
323323
if (manageConfig != null && manageConfig.isCleanJsonPayloads()) {
324324
json = cleanJsonPayload(json);
325325
}

src/test/java/com/marklogic/appdeployer/command/databases/InvokeDatabaseOperationsTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.marklogic.appdeployer.command.databases;
22

3+
import com.marklogic.mgmt.api.API;
4+
import com.marklogic.mgmt.api.database.Database;
5+
import com.marklogic.mgmt.mapper.DefaultResourceMapper;
36
import org.junit.After;
47
import org.junit.Test;
58

@@ -25,5 +28,10 @@ public void test() {
2528
// Just smoke-testing these to make sure they don't blow up
2629
mgr.mergeDatabase(appConfig.getContentDatabaseName());
2730
mgr.reindexDatabase(appConfig.getContentDatabaseName());
31+
32+
String json = mgr.getPropertiesAsJson(appConfig.getContentDatabaseName());
33+
System.out.println(json);
34+
Database db = new DefaultResourceMapper(new API(manageClient)).readResource(json, Database.class);
35+
assertEquals("ÉÉÉ", db.getRangeElementIndex().get(0).getLocalname());
2836
}
2937
}
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
{
2-
"database-name": "%%DATABASE%%"
2+
"database-name": "%%DATABASE%%",
3+
"range-element-index": [
4+
{
5+
"collation": "http://marklogic.com/collation/",
6+
"invalid-values": "reject",
7+
"localname": "ÉÉÉ",
8+
"namespace-uri": "",
9+
"range-value-positions": false,
10+
"scalar-type": "string"
11+
}
12+
]
313
}

0 commit comments

Comments
 (0)