我应该在哪里对我的 POST 请求数据进行 URL 编码?对于每个参数,还是整个查询行?
例如,我有这个代码:
@VIEWSTATE = url_encode(@VIEWSTATE)
data = ("__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=#{@VIEWSTATE}&__EVENTVALIDATION=#{@EVENTVALIDATION}&=ctl0.......
headers = {
'Cookie' => cookie,
***
}
resp, data = http.post(path, data, headers)
是对的,还是我必须写:
@VIEWSTATE = @VIEWSTATE
data = url_encode("__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=#{@VIEWSTATE}&__EVENTVALIDATION=#{@EVENTVALIDATION}&=ctl0.......
headers = {
'Cookie' => cookie,
***
}
resp, data = http.post(path, data, headers)
哪个是正确的,哪个更好?