Open amozano opened 5 years ago
There appears to be a bug marshaling data from Java REST APIs as UTF-8:
restResponse = new Rest().url("http://10.10.10.10/v1/pki/revoke") .header("X-Vault-Token", "2gcg9zsB4pa9FlGSzsdfKAys") .parameter("serial_number", "04-f7-bd-36-ce-24-eb-da-a7-6b-76-37-b7-93-99-58-ac-3e-65-f9") .post();
Results in 400 status code: {"errors":["failed to parse JSON input: invalid character 's' looking for beginning of value"]}
Must put serial_number in body and explicitly convert:
restResponse = new Rest().url("http://10.10.10.10/v1/pki/revoke") .header("X-Vault-Token", "2gcg9zsB4pa9FlGSzsdfKAys") .body("{ \"serial_number\": \"04-f7-bd-36-ce-24-eb-da-a7-6b-76-37-b7-93-99-58-ac-3e-65-f9\" }".getBytes(StandardCharsets.UTF_8)) .post();
Results in 204 status code.
There appears to be a bug marshaling data from Java REST APIs as UTF-8:
restResponse = new Rest().url("http://10.10.10.10/v1/pki/revoke") .header("X-Vault-Token", "2gcg9zsB4pa9FlGSzsdfKAys") .parameter("serial_number", "04-f7-bd-36-ce-24-eb-da-a7-6b-76-37-b7-93-99-58-ac-3e-65-f9") .post();
Results in 400 status code: {"errors":["failed to parse JSON input: invalid character 's' looking for beginning of value"]}
Must put serial_number in body and explicitly convert:
restResponse = new Rest().url("http://10.10.10.10/v1/pki/revoke") .header("X-Vault-Token", "2gcg9zsB4pa9FlGSzsdfKAys") .body("{ \"serial_number\": \"04-f7-bd-36-ce-24-eb-da-a7-6b-76-37-b7-93-99-58-ac-3e-65-f9\" }".getBytes(StandardCharsets.UTF_8)) .post();
Results in 204 status code.