0
Webブラウザーで要求を行うと、同じCSV出力を生成する2つのHTTP要求があります。両方のリクエストのURLパラメータの最初の部分は同じなので省略しています。それだけであなたは以下を参照することができ、最後のパラメータを変更します。可能なURLエンコーディングの問題
リクエストA:
https://csv.business.tomtom.com/extern?...[other parameters]...&range_pattern=d-1
リクエストB:
https://csv.business.tomtom.com/extern?...[other parameters]...&rangefrom_string=01/04/2016 00:00:01&rangeto_string=01/04/2016 23:59:59
CSV出力
"start_time","end_time","distance","triptime","operatingtime","standstill","tours","fuel_usage"
"01/04/2016 09:27:39","01/04/2016 17:25:51","293121","15187","28692","2759","4","21.024"
しかし私が作るときレールアプリからのリクエストリクエストBでエラーが発生しました。リクエストAはOKです。
エラー:
CSV::MalformedCSVError
...
Illegal quoting in line 1.
...
@tripsSummary = CSV.parse(summaryResponse.to_s)
これらは、HTTPレスポンスです:
応答
#<HTTP::Response/1.1 200 OK {"Access-Control-Allow-Origin"=>"*", "Access-Control-Allow-Methods"=>"GET", "Access-Control-Max-Age"=>"3600", "Access-Control-Allow-Headers"=>"Origin, X-Requested-With, Content-Type, Accept", "Content-Type"=>"text/comma-separated-values;charset=UTF-8", "Date"=>"Sat, 02 Apr 2016 19:16:04 GMT", "Connection"=>"close", "Transfer-Encoding"=>"chunked"}>
レスポンスB
#<HTTP::Response/1.1 200 OK {"Connection"=>"close", "Cache-Control"=>"no-cache", "Content-Type"=>"text/html; charset=iso-8859-1", "Pragma"=>"no-cache", "Content-Length"=>"108"}>
質問
- リクエストBが不正ですか?
- なぜブラウザで動作し、 がアプリで動作しないのですか?
- rangefrom_string = 01/04/2016 00:00:01のパラメータにエンコードの問題がありますか?