Merge pull request #729 from hapifhir/gg-202202-http-issues

fix up http issues?
This commit is contained in:
Grahame Grieve 2022-02-01 12:39:58 +11:00 committed by GitHub
commit 74aaa2f03d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -147,7 +147,7 @@ public class SimpleHTTPClient {
}
}
return new HTTPResult(url, c.getResponseCode(), c.getRequestProperty("Content-Type"), TextFile.streamToBytes(c.getInputStream()));
return new HTTPResult(url, c.getResponseCode(), c.getRequestProperty("Content-Type"), TextFile.streamToBytes(c.getResponseCode() >= 400 ? c.getErrorStream() : c.getInputStream()));
}
private void setHeaders(HttpURLConnection c) {
@ -177,7 +177,7 @@ public class SimpleHTTPClient {
setHeaders(c);
c.getOutputStream().write(content);
c.getOutputStream().close();
return new HTTPResult(url, c.getResponseCode(), c.getRequestProperty("Content-Type"), TextFile.streamToBytes(c.getInputStream()));
return new HTTPResult(url, c.getResponseCode(), c.getRequestProperty("Content-Type"), TextFile.streamToBytes(c.getResponseCode() >= 400 ? c.getErrorStream() : c.getInputStream()));
}
@ -194,7 +194,7 @@ public class SimpleHTTPClient {
setHeaders(c);
c.getOutputStream().write(content);
c.getOutputStream().close();
return new HTTPResult(url, c.getResponseCode(), c.getRequestProperty("Content-Type"), TextFile.streamToBytes(c.getInputStream()));
return new HTTPResult(url, c.getResponseCode(), c.getRequestProperty("Content-Type"), TextFile.streamToBytes(c.getResponseCode() >= 400 ? c.getErrorStream() : c.getInputStream()));
}

View File

@ -91,7 +91,7 @@ public class PackageClient {
address));
}
}
} catch (FileNotFoundException e) {
} catch (Exception e) {
}
return res;
}