Merge pull request #718 from hapifhir/test-simplehttpclient-https

Add test for SimpleHttpClient and https
This commit is contained in:
Grahame Grieve 2022-02-01 11:50:20 +11:00 committed by GitHub
commit 5b66d3fe42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package org.hl7.fhir.utilities;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SimpleHTTPClientTest {
@Test
public void testSimpleHTTPClient() throws IOException {
SimpleHTTPClient http = new SimpleHTTPClient();
String url = "https://hl7.org/fhir/us/core/package-list.json?nocache=" + System.currentTimeMillis();
SimpleHTTPClient.HTTPResult res = http.get(url, "application/json");
System.out.println(res.getCode());
System.out.println(new String(res.getContent(), StandardCharsets.UTF_8));
assertTrue(res.getCode() != 400);
}
}