質問編集履歴

3

エラーを更新

2018/09/19 17:09

投稿

GenkiMatsushima
GenkiMatsushima

スコア24

test CHANGED
File without changes
test CHANGED
@@ -164,13 +164,9 @@
164
164
 
165
165
  このようになっています。
166
166
 
167
- エラーとしてレスポンスにbodyがありません。
167
+ ```Error
168
168
 
169
- ```response
170
-
171
- Response {type: "cors", url: "http://0.0.0.0:8000/business_term/search/", redirected: false, status: 200, ok: true, …}
172
-
173
- 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

169
+ responseError(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.})
174
170
 
175
171
  ```
176
172
 

2

エラーをレスポンスとして更新しました。

2018/09/19 17:09

投稿

GenkiMatsushima
GenkiMatsushima

スコア24

test CHANGED
File without changes
test CHANGED
@@ -164,17 +164,13 @@
164
164
 
165
165
  このようになっています。
166
166
 
167
- エラーとしては、
167
+ エラーとしてレスポンスにbodyがありません。
168
168
 
169
- ```error
169
+ ```response
170
170
 
171
- responseError(Error Domain=NSCocoaErrorDomain Code=3840
171
+ Response {type: "cors", url: "http://0.0.0.0:8000/business_term/search/", redirected: false, status: 200, ok: true, …}
172
172
 
173
- "JSON body:(...)
bodyUsed:false
headers:Headers {}
ok:text 
redid no:false
st s:200
start with arra:"OK"
ty or os"
url:"http://0.0.0.0:8000/bject and orch/"
__ption to allow fragments not set."
173
+ 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
174
-
175
- UserInfo={NSDebugDescription=JSON text did not start with array
176
-
177
- or object and option to allow fragments not set.})
178
174
 
179
175
  ```
180
176
 

1

pythonのコードにてレスポンスを記述していませんでした。

2018/09/18 13:59

投稿

GenkiMatsushima
GenkiMatsushima

スコア24

test CHANGED
File without changes
test CHANGED
@@ -140,13 +140,23 @@
140
140
 
141
141
  cursor.execute(sql)
142
142
 
143
+ data = cursor.fetchall()
144
+
143
145
 
144
146
 
145
147
  cursor.close()
146
148
 
147
- connection.commit()
149
+ connection.close()
148
150
 
151
+
152
+
153
+ res.status = falcon.HTTP_200
154
+
155
+ res.body = json.dumps(data)
156
+
149
- connection.close()
157
+ print(res.body)
158
+
159
+
150
160
 
151
161
  ```
152
162