我有一个帖子调用,需要发送表单数据来代替通常的有效负载数据。 POST呼叫详细信息如下:
.....
.....
Request Method:POST
Status Code:200 OK
Response Headers
view source
Content-Type:text/html;charset=UTF-8
Date:Mon, 06 Apr 2015 07:46:03 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:1777
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=F092185CFE09E4F99C2324A05D56DD14; username=root; doNotShowStartupOnLoad=true
Host:192.x.x.x.
Origin:https://192.x.x.x
Referer:https://192.x.x.x/login.......
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36
Query String Parameters
view source
view URL encoded
dojoIframeSend:true
request.preventCache:1428306581553
Form Data
view source
view URL encoded
savedReportsInclude:true
fromDetailsPage:true
launchCommand:savedReports
reportType:detailed_sw_report
reportDisplayName:Detailed Software
formSubmitId:0.6209534616209567
viewType:createCase
reportCategory:Device
reportName:detailed_sw_report
scopeInstance:
scopeInstanceKey:
extFilterInstance:
extFilterInstanceKey:
apFilterInstance:
apFilterInstanceKey:
attrGroupNames:
savedScopeName:
command:addAndRunReport
weekDaysBool:false
weekDaysBool:false
weekDaysBool:false
weekDaysBool:false
weekDaysBool:false
weekDaysBool:false
weekDaysBool:false
reportFile:nothing
exportNowMode:0
selectedColumnList:
hiddenColumnList:
fixedColumnList:
selectedDisplayColumnList:
hiddenDisplayColumnList:
fixedDisplayColumnList:
customizableReportsViewList:
sortOrderColumnList:
sortingColumnList:
emailServerSet:false
defaultFilterValuesList:
defaultFilterkeyList:
filterInternalNames:
settingsContentDisplay:display
scheduleContentDisplay:display
runContentDisplay:display
savePath:/localdisk/ftp/reports/DetailedSoftware/<ReportTitleName>_<yyyymmdd>_<HHMMSS>
reportFromContext:false
reportDescriptorType:2
doNotIncludeReportsList:
tempReportTitle:
maxRowsInSingleGraph:0
singleGraphOmittedRows:0
htmlEmailAddr:
htmlEmailSubject:
graphicalPageSize:
includeEmailWithExport:false
includeReportAsAttachmentWithExport:false
totalRecordCount:
totalRecordInfo:
htmlPageSize:
virtualDomainChildrenCount:0
customizedReportSizeList:
anyDomainChildrenPresent:false
pagingContextId:
reportTitle:1213
reportAggregatorName:detailed_sw_report
extFilterTF0:
extFilterTF1:
extFilterTF2:
extFilterTF3:
reportSize:50
destType:
emailAddr:
csrf_token:71d89916ee764fa761554b3018f7790f0dc531db23728809e177b9b51ef976a8
csrf_token:71d89916ee764fa761554b3018f7790f0dc531db23728809e177b9b51ef976a8
我正在尝试将此数据发送为: FORM_DATA是以下列形式定义数据的地方:
FORM_DATA = {
testcase1: {
savedReportsInclude:true ,
fromDetailsPage:true ,
launchCommand:"savedReports" ,
reportType:"detailed_sw_report",
.
.
.
}
}
这是我的代码尝试POST cal并进行验证。
TestDataTest::FORM_DATA.each do |k,v|
puts k, v
form_data = JSON.parse(v.to_json)
url = "...something/reportsAction.do"
$agent.post url, form_data.to_json, {'Content-Type' => 'application/json'}
response = $agent.page.body
puts "Response: #{response}"
end
我在回复结束时得到的回复: &#34;意外错误:请参阅日志文件以获取更多信息。&#34;
在开发人员工具中,我没有看到此消息。请帮助我如何使用表单数据进行submi POST调用(我正在使用mechanize gem和ruby)