question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem loading JSON from server with axios

See original GitHub issue

Please see https://stackblitz.com/edit/reactjs-dynamic-dom-generation. The axios.get() response appears to be the base site HTML (see below) instead of the desired JSON content.

General

Request URL:https://reactjs-dynamic-dom-generation.stackblitz.io/example-ui.json Request Method:GET Status Code:200 Remote Address:[2600:9000:201e:1600:19:8e3c:5200:93a1]:443 Referrer Policy:no-referrer-when-downgrade

Response Headers

cache-control:max-age=0, private, must-revalidate content-type:text/html; charset=utf-8 date:Sat, 16 Sep 2017 18:36:13 GMT etag:W/“48b1155c80f50b4f5c8e5440ffc7eeb2” server:StackBlitz status:200 via:1.1 94812f867206232855f09570ec52b557.cloudfront.net (CloudFront) x-amz-cf-id:Nb2s6WfFir35EzmKfsnV_VKBYwKleH8lTAjpipEfBOUor_a-QlHI9w== x-cache:Miss from cloudfront x-content-type-options:nosniff x-request-id:c7c79c5b-d872-4397-8e57-0c509a79442d x-runtime:0.008019 x-xss-protection:1; mode=block

Request Headers

:authority:reactjs-dynamic-dom-generation.stackblitz.io :method:GET :path:/example-ui.json :scheme:https accept:application/json, text/plain, / accept-encoding:gzip, deflate, br accept-language:en-US,en;q=0.8 cache-control:no-cache dnt:1 pragma:no-cache referer:https://reactjs-dynamic-dom-generation.stackblitz.io/ user-agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36

Response

<!DOCTYPE html>
<html>
<head>
  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Lato:400,700,900" rel="stylesheet">
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" media="screen" href="https://static.stackblitz.com/assets/packs/preview-746d7a3dc62c171240af3f9f71cc1d6b.css" />
  <script src="https://static.stackblitz.com/assets/packs/common-1c527903f55d7b21739a.js"></script>
  <script src="https://static.stackblitz.com/assets/engineblock-f47e9b5359bb3ef0d1410b136569c70510685f8187c47555257a4acd57179667.js"></script>
  <script src="https://static.stackblitz.com/assets/packs/preview-0bb9aab2c643afed2775.js"></script>
  <script>(function(){_preboot(["https://b.stackblitz.com/reactjs-dynamic-dom-generation/a.TYg78nHEGgfL2puS.js","https://b.stackblitz.com/reactjs-dynamic-dom-generation/v.K6R72434HsvZPY8m.js"])})()</script>
</head>
<body></body>
</html>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
EricSimonscommented, Sep 20, 2017

@rnadler thanks for filing an issue about this! We currently don’t support static assets, but we’re shooting to have support out for it next week. Will circle back here once it has been implemented 😃

0reactions
purplem1lkcommented, Apr 30, 2021

Thank you for your patience - We are launching new core technology into beta next month that should resolve this issue so this will be closed accordingly. If this issue persists, feel free to tag me or ask to reopen this issue with screenshots of the error. Thank you! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble getting local JSON data with axios - Stack Overflow
Simply put your json file in public folder and call it using axios. Suppose if you have json file named called data.json in...
Read more >
You may not need Axios - Dan Levy's Programming Blog
Get JSON from a URL; Custom headers; HTTP Error Handling; CORS example; Posting JSON ... Promise.reject(new Error('Failed to load data from server')).
Read more >
Understanding Axios POST requests - LogRocket Blog
Learn how to use the Axios POST method in both vanilla JavaScript and in a framework like React to send requests.
Read more >
Create a Vue.js 3 App with JSON Server and Axios
This tutorial will show you how to create a Vue.js 3 app with JSON Server and Axios. json-server is a package that creates...
Read more >
Making HTTP requests with Axios - CircleCI
In this response, you get an object of the data that you are expecting, the status code sent back by the server, a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found