Skip to content

Commit

Permalink
W-13957966. Added error message including cors message
Browse files Browse the repository at this point in the history
  • Loading branch information
spezzirriemiliano committed Aug 28, 2023
1 parent e676682 commit 62aa2c6
Show file tree
Hide file tree
Showing 4 changed files with 256 additions and 229 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@advanced-rest-client/arc-response",
"description": "A module containing the UI regions and the logic to render and support HTTP response in Advanced REST Client.",
"version": "0.3.10",
"version": "0.3.11",
"license": "Apache-2.0",
"main": "index.js",
"module": "index.js",
Expand Down
10 changes: 10 additions & 0 deletions src/ResponseViewElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,16 @@ export class ResponseViewElement extends LitElement {
* @returns {TemplateResult} Template for the response preview
*/
[responseBodyTemplate](payload, headers='', opened) {
if ((this[responseValue] || {}).status === 0) {
return html`
<div class="response-error-title">The HTTP request couldn’t be made.</div>
<div class="response-error-description">
Please check the URL and try again. If the issue persists,
<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors" target="_blank">CORS</a> may be blocking the request. Unfortunately,
we can't modify this behavior as the target server is a third-party server.
</div>
`;
}
if (!payload) {
return html`<p>The response contains no body.</p>`;
}
Expand Down
Loading

0 comments on commit 62aa2c6

Please sign in to comment.