teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

URLが間違っていました。

2018/09/18 17:54

投稿

GenkiMatsushima
GenkiMatsushima

スコア24

title CHANGED
File without changes
body CHANGED
@@ -104,7 +104,7 @@
104
104
 
105
105
  ```JSコンソール
106
106
  Response {type: "cors", url: "http://0.0.0.0:8000", redirected: false, status: 200, ok: true, …}
107
- body:(...)
bodyUsed:false
headers:Headers {}
ok:true
redirected:false
status:200
statusText:"OK"
type:"cors"
url:"http://0.0.0.0:8000/business_term/search/"
__proto__:Response

107
+ body:(...)
bodyUsed:false
headers:Headers {}
ok:true
redirected:false
status:200
statusText:"OK"
type:"cors"
url:"http://0.0.0.0:8000"
__proto__:Response

108
108
  ```
109
109
 
110
110
  問題として、Javascript側でのfetch成功時にresの中身を出力してみるのですが、bodyの中身がカラになってしまい、JSON取得が失敗となってしまいます。

2

URLが間違っていました。

2018/09/18 17:54

投稿

GenkiMatsushima
GenkiMatsushima

スコア24

title CHANGED
File without changes
body CHANGED
@@ -103,7 +103,7 @@
103
103
  ```
104
104
 
105
105
  ```JSコンソール
106
- Response {type: "cors", url: "http://0.0.0.0:8000/business_term/search/", redirected: false, status: 200, ok: true, …}
106
+ Response {type: "cors", url: "http://0.0.0.0:8000", redirected: false, status: 200, ok: true, …}
107
107
  body:(...)
bodyUsed:false
headers:Headers {}
ok:true
redirected:false
status:200
statusText:"OK"
type:"cors"
url:"http://0.0.0.0:8000/business_term/search/"
__proto__:Response

108
108
  ```
109
109
 

1

コンソールコードを追加

2018/09/18 17:54

投稿

GenkiMatsushima
GenkiMatsushima

スコア24

title CHANGED
File without changes
body CHANGED
@@ -102,6 +102,10 @@
102
102
  }
103
103
  ```
104
104
 
105
+ ```JSコンソール
106
+ Response {type: "cors", url: "http://0.0.0.0:8000/business_term/search/", redirected: false, status: 200, ok: true, …}
107
+ body:(...)
bodyUsed:false
headers:Headers {}
ok:true
redirected:false
status:200
statusText:"OK"
type:"cors"
url:"http://0.0.0.0:8000/business_term/search/"
__proto__:Response

108
+ ```
105
109
 
106
110
  問題として、Javascript側でのfetch成功時にresの中身を出力してみるのですが、bodyの中身がカラになってしまい、JSON取得が失敗となってしまいます。
107
111