質問編集履歴

3

解決を別欄に記入し直す

2019/11/26 23:39

投稿

s.kozy
s.kozy

スコア16

test CHANGED
File without changes
test CHANGED
@@ -201,69 +201,3 @@
201
201
  _0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]]
202
202
 
203
203
  ```
204
-
205
-
206
-
207
- ### 解決
208
-
209
-
210
-
211
- ###### 修正前
212
-
213
- request-client.js
214
-
215
- ```
216
-
217
- export class RequestClient {
218
-
219
- constructor(axios) {
220
-
221
- this.axios = axios
222
-
223
- }
224
-
225
-
226
-
227
- async get(uri, params = {}) {
228
-
229
- const queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&');
230
-
231
- const query = queryString.length > 0 ? `${uri}?${queryString}` : uri
232
-
233
- return await this.axios.$get(query)
234
-
235
- }
236
-
237
-
238
-
239
- async post(uri) {
240
-
241
- return await this.axios.$post(uri, data)
242
-
243
- }
244
-
245
- }
246
-
247
-
248
-
249
- export function createRequestClient(axios) {
250
-
251
- return new RequestClient(axios)
252
-
253
- }
254
-
255
- ```
256
-
257
- ↓↓↓↓↓↓
258
-
259
- ###### 修正後
260
-
261
- ```
262
-
263
- async post(uri, data = {}) {
264
-
265
- return await this.axios.$post(uri, data)
266
-
267
- }
268
-
269
- ```

2

解決方法の追記

2019/11/26 23:39

投稿

s.kozy
s.kozy

スコア16

test CHANGED
File without changes
test CHANGED
@@ -196,8 +196,74 @@
196
196
 
197
197
  ```
198
198
 
199
- 2019/11/26 08:17:47 sake_review_api.go:44: map[Accept:[application/json, text/plain, */*] Accept-Encoding:[gzip, deflate, br] Accept-Language:[ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7] Authorization:[Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjRhOWEzMGI5ZThkYTMxNjY2YTY3NTRkZWZlZDQxNzQzZjJlN2FlZWEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vc2FrZS1kaWFyeS0xMTEzIiwiYXVkIjoic2FrZS1kaWFyeS0xMTEzIiwiYXV0aF90aW1lIjoxNTc0NzUyMjQxLCJ1c2VyX2lkIjoiZ01BdWIwYjNab2RLZ3F5bTlnMzNsb092VnFJMyIsInN1YiI6ImdNQXViMGIzWm9kS2dxeW05ZzMzbG9PdlZxSTMiLCJpYXQiOjE1NzQ3NTIyNDEsImV4cCI6MTU3NDc1NTg0MSwiZW1haWwiOiJrb2ppLjE5OTYwODEwQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYyJrb2ppLjE5OTYwODEwQGdtYWlsLmNvbSJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.WZlVR39tTRYEd63_WiyibR4_JG9Nh_imx02io6YgFhdkPwXS2IMYx1MaEG5W4JY4PN5dGMeglkPH37DznB8io3gm2HK5FIAZXf3MWl9Lf4jJWEQcyrVDUPC8u8yUE4GokpGvDwwehLNDnLlR6bfLH89RCX-SaHp6wxw_BwYgffCveExWMZXa9pJxAjN2Qc_QeaAjZVdb6H6GDuLxJ2AjGV27_rGK0uRsn5jt1cXbs81Y-8Rv9uNctZrE5FvwXsoMUR9pCHuJquVztKBtFuNf69FP7X0xK98feox2FJhHAR1PpTzFbx9Pet2p6Ly4pGTz_TZvgKukT4kFkK_Y9LGu2A] Connection:[keep-alive] Content-Length:[0] Origin:[http://localhost:3000] Referer:[http://localhost:3000/sake/P002604?sake_name=%E3%80%86&maker_name=%E4%BC%8A%E6%9D%B1%E9%85%92%E9%80%A0] Sec-Fetch-Mode:[cors] Sec-Fetch-Site:[same-site] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]]`
199
+ 2019/11/26 08:17:47 sake_review_api.go:44: map[Accept:[application/json, text/plain, */*] Accept-Encoding:[gzip, deflate, br] Accept-Language:[ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7] Authorization:[Bearer eyJhbGciOiJSUzI1NiIsImtpkT4kFkK_Y9LGu2A] Connection:[keep-alive] Content-Length:[0] Origin:[http://localhost:3000] Referer:[http://localhost:3000/sake/P002604?sake_name=%E3%80%86&maker_name=%E4%BC%8A%E6%9D%B1%E9%85%92%E9%80%A0] Sec-Fetch-Mode:[cors] Sec-Fetch-Site:[same-site] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]]`
200
200
 
201
201
  _0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]]
202
202
 
203
203
  ```
204
+
205
+
206
+
207
+ ### 解決
208
+
209
+
210
+
211
+ ###### 修正前
212
+
213
+ request-client.js
214
+
215
+ ```
216
+
217
+ export class RequestClient {
218
+
219
+ constructor(axios) {
220
+
221
+ this.axios = axios
222
+
223
+ }
224
+
225
+
226
+
227
+ async get(uri, params = {}) {
228
+
229
+ const queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&');
230
+
231
+ const query = queryString.length > 0 ? `${uri}?${queryString}` : uri
232
+
233
+ return await this.axios.$get(query)
234
+
235
+ }
236
+
237
+
238
+
239
+ async post(uri) {
240
+
241
+ return await this.axios.$post(uri, data)
242
+
243
+ }
244
+
245
+ }
246
+
247
+
248
+
249
+ export function createRequestClient(axios) {
250
+
251
+ return new RequestClient(axios)
252
+
253
+ }
254
+
255
+ ```
256
+
257
+ ↓↓↓↓↓↓
258
+
259
+ ###### 修正後
260
+
261
+ ```
262
+
263
+ async post(uri, data = {}) {
264
+
265
+ return await this.axios.$post(uri, data)
266
+
267
+ }
268
+
269
+ ```

1

情報の追加

2019/11/26 23:31

投稿

s.kozy
s.kozy

スコア16

test CHANGED
File without changes
test CHANGED
@@ -179,3 +179,25 @@
179
179
  }
180
180
 
181
181
  ```
182
+
183
+
184
+
185
+
186
+
187
+ ------
188
+
189
+ ###追記
190
+
191
+
192
+
193
+
194
+
195
+ リクエストヘッダー情報
196
+
197
+ ```
198
+
199
+ 2019/11/26 08:17:47 sake_review_api.go:44: map[Accept:[application/json, text/plain, */*] Accept-Encoding:[gzip, deflate, br] Accept-Language:[ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7] Authorization:[Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjRhOWEzMGI5ZThkYTMxNjY2YTY3NTRkZWZlZDQxNzQzZjJlN2FlZWEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vc2FrZS1kaWFyeS0xMTEzIiwiYXVkIjoic2FrZS1kaWFyeS0xMTEzIiwiYXV0aF90aW1lIjoxNTc0NzUyMjQxLCJ1c2VyX2lkIjoiZ01BdWIwYjNab2RLZ3F5bTlnMzNsb092VnFJMyIsInN1YiI6ImdNQXViMGIzWm9kS2dxeW05ZzMzbG9PdlZxSTMiLCJpYXQiOjE1NzQ3NTIyNDEsImV4cCI6MTU3NDc1NTg0MSwiZW1haWwiOiJrb2ppLjE5OTYwODEwQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYyJrb2ppLjE5OTYwODEwQGdtYWlsLmNvbSJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.WZlVR39tTRYEd63_WiyibR4_JG9Nh_imx02io6YgFhdkPwXS2IMYx1MaEG5W4JY4PN5dGMeglkPH37DznB8io3gm2HK5FIAZXf3MWl9Lf4jJWEQcyrVDUPC8u8yUE4GokpGvDwwehLNDnLlR6bfLH89RCX-SaHp6wxw_BwYgffCveExWMZXa9pJxAjN2Qc_QeaAjZVdb6H6GDuLxJ2AjGV27_rGK0uRsn5jt1cXbs81Y-8Rv9uNctZrE5FvwXsoMUR9pCHuJquVztKBtFuNf69FP7X0xK98feox2FJhHAR1PpTzFbx9Pet2p6Ly4pGTz_TZvgKukT4kFkK_Y9LGu2A] Connection:[keep-alive] Content-Length:[0] Origin:[http://localhost:3000] Referer:[http://localhost:3000/sake/P002604?sake_name=%E3%80%86&maker_name=%E4%BC%8A%E6%9D%B1%E9%85%92%E9%80%A0] Sec-Fetch-Mode:[cors] Sec-Fetch-Site:[same-site] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]]`
200
+
201
+ _0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36]]
202
+
203
+ ```