testdata fastexact search response
parent
9ff1302a73
commit
37a18acdfe
|
|
@ -107,7 +107,20 @@ func (fe FastExact) searchOne(state config.State) ([]Job, error) {
|
|||
}
|
||||
|
||||
func (fe FastExact) newRequest(state config.State) (*http.Request, error) {
|
||||
return nil, errors.New("not impl: fe.newreq")
|
||||
zip, ok := config.States[state]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no configured zip for %s", state)
|
||||
}
|
||||
req, err := http.NewRequest(
|
||||
http.MethodGet,
|
||||
"https://www.fastexact.com/secure/index.php?page=ajaxListJobs&action=ajax&zipcode="+zip+"&records_per_page=50&distance=300&st_loc_zip=8",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fe.setHeaders(req)
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func (fe FastExact) doRequest(req *http.Request) (*http.Response, error) {
|
||||
|
|
@ -121,20 +134,43 @@ func (fe FastExact) parse(resp *http.Response) ([]Job, error) {
|
|||
type mockFastExactDoer struct{}
|
||||
|
||||
func (mock mockFastExactDoer) doRequest(req *http.Request) (*http.Response, error) {
|
||||
switch req.URL.Path {
|
||||
case "/secure/index.php":
|
||||
if req.URL.Query().Get("page") != "userLogin" {
|
||||
return nil, errors.New("bad query")
|
||||
}
|
||||
if req.URL.Path != "/secure/index.php" {
|
||||
return nil, errors.New("bad path")
|
||||
}
|
||||
switch req.URL.Query().Get("page") {
|
||||
case "userLogin":
|
||||
if b, _ := ioutil.ReadAll(req.Body); !bytes.Equal(b, []byte(`user_name=u&user_password=p&buttonSubmit=Login`)) {
|
||||
return nil, errors.New("bad req body")
|
||||
}
|
||||
return &http.Response{
|
||||
Status: http.StatusText(http.StatusOK),
|
||||
StatusCode: http.StatusOK,
|
||||
Header: http.Header{"Set-Cookie": []string{"PHPSESSID=8o0slo18q6cr0v5v5k9ohjcg01; path=/"}},
|
||||
Header: http.Header{"Set-Cookie": []string{"PHPSESSID=SessionFromLogin; path=/"}},
|
||||
Body: io.NopCloser(bytes.NewReader([]byte{})),
|
||||
}, nil
|
||||
case "ajaxListJobs":
|
||||
if req.URL.Query().Get("action") != "ajax" {
|
||||
return nil, errors.New("bad query: action should be ajax")
|
||||
}
|
||||
if req.URL.Query().Get("records_per_page") != "50" {
|
||||
return nil, errors.New("bad query: records_per_page should be 50")
|
||||
}
|
||||
if req.URL.Query().Get("distance") != "300" {
|
||||
return nil, errors.New("bad query: distance should be 300")
|
||||
}
|
||||
if req.URL.Query().Get("zipcode") == "" {
|
||||
return nil, errors.New("bad query: zip code empty")
|
||||
}
|
||||
b, err := ioutil.ReadFile("./testdata/fastexact_search.xml")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &http.Response{
|
||||
Status: http.StatusText(http.StatusOK),
|
||||
StatusCode: http.StatusOK,
|
||||
Header: http.Header{"Set-Cookie": []string{"PHPSESSID=SessionFromSearch; path=/"}},
|
||||
Body: io.NopCloser(bytes.NewReader(b)),
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.New("bad path")
|
||||
return nil, errors.New("bad query")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ curl -sS \
|
|||
-H 'Accept-Language: en-US,en;q=0.5' \
|
||||
-H 'Accept-Encoding: gzip, deflate, br' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-H 'Cookie: PHPSESSID=36n1p1rrp5e2ad5ms0qvhp37m1' \
|
||||
-H 'Cookie: PHPSESSID=vq4ss3lbfg0viluaau7e0d32q6' \
|
||||
| gzip -d
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
<form name="frm_search" action="index.php?page=manageJobs" method="post">
|
||||
<a href="https://play.google.com/store/apps/details?id=app.FastExact" target="_blank" title="Android app, Available in the App Store, Download and get all more..." class="android_app"></a>
|
||||
<a href="http://itunes.apple.com/us/app/fastexact/id497933887?mt=8" target="_blank" title="iPhone app, Available in the App Store, Download and get all more..." class="iphone_app"></a>
|
||||
<div class="search_box w67p">
|
||||
<div class="header"><strong>Search</strong> <span class="usZipLink"><a href="http://zip4.usps.com/zip4/citytown.jsp" title="US Zip Code Finder" target="_blank">US Zip Code Finder »</a></span> </div>
|
||||
<div class="content">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td valign="top" width="342"><strong>Enter your Zip Code to show radius
|
||||
<!--of 100 miles-->
|
||||
from your location</strong></td>
|
||||
<td valign="top" width="68"><input type="text" name="zipcode" id="zipcode" value="27006" onKeyPress="return disableEnterKey(event)" onkeydown="if(event.keyCode == 13){radiusSearch('10')}" /></td>
|
||||
<td valign="top" width="59"><select name="distance" id="distance" class="select" onkeydown="if(event.keyCode == 13){radiusSearch('10')}">
|
||||
<option value="100" >100</option>
|
||||
<option value="200" >200</option>
|
||||
<option value="300" selected=selected>300</option>
|
||||
</select></td>
|
||||
<td valign="top" width="128"><!--<input type="checkbox" name="st_loc_zip" id="st_loc_zip" value="1" class="ownBox" checked=checked onKeyPress="return disableEnterKey(event)" onkeydown="if(event.keyCode == 13){radiusSearch('10')}"/>--></td>
|
||||
<td valign="top" class="padr12" width="337">Make this your current zip code<br />
|
||||
for the next
|
||||
<select name="st_loc_zip" id="st_loc_zip" class="dropdown">
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8" selected="selected">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
</select>
|
||||
hours.<a href="javascript:radiusSearch('10','save');" ><img src="images/buttons/save.png" /></a></td>
|
||||
<td valign="top"><a href="javascript:radiusSearch('10','search');"><img src="images/buttons/search.gif" alt="Search" align="middle" title="Search" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="br"></div>
|
||||
</form>
|
||||
<br clear="all" />
|
||||
<div id="list" align="center">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="Order List">
|
||||
<tr>
|
||||
<th width="14%" height="38" align="center">ID <span id="sort8"><a href="javascript:contentSort('ordernum=8&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',8)"> <img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0" /></a></span></th>
|
||||
<th width="14%" height="38" align="center">Origin <span id="sort1"><a href="javascript:contentSort('ordernum=1&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',1)"> <img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0" /></a></span></th>
|
||||
<th width="14%" height="38" align="center">Destination <span id="sort2"><a href="javascript:contentSort('ordernum=2&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',2)"> <img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0" /></a></span></th>
|
||||
<th width="14%" height="38" align="center">Mile <span id="sort3"><a href="javascript:contentSort('ordernum=3&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',3)"> <img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0" /></a></span></th>
|
||||
<th height="38" align="center">Pieces / Weight <span id="sort4"><a href="javascript:contentSort('ordernum=4&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',4)"> <img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0"/></a></span></th>
|
||||
<th width="14%" height="38" align="center">Dimension <span id="sort5"><a href="javascript:contentSort('ordernum=5&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',5)"><img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0"/></a></span></th>
|
||||
<th width="14%" height="38" align="center">Vehicle Size <span id="sort5"><a href="javascript:contentSort('ordernum=5&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',5)"><img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0"/></a></span></th>
|
||||
<th width="20%" height="38" align="center">Pickup (EST) <span id="sort6"><a href="javascript:contentSort('ordernum=6&dir=asc&pageNum=1&zipcode=27006&distance=300&st_loc_zip=8&records_per_page=10',6)"> <img src="https://www.fastexact.com/secure/images/sortarrow_down.gif" border="0" /></a></span></th>
|
||||
<th width="6%" height="38" align="center">View</th>
|
||||
</tr>
|
||||
<tr >
|
||||
<td align="center" height="38">Z-5344222</td>
|
||||
<td align="center" height="38">Circleville, OH 43113</td>
|
||||
<td align="center">Willard, OH 44890</td>
|
||||
<td align="center">128</td>
|
||||
<td align="center">4 / 4800</td>
|
||||
<td align="center">96x48x88in.</td>
|
||||
<td align="center">SMALL STRAIGHT</td>
|
||||
<td align="center">31-Jan-2022 17:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344222"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<td align="center" height="38">Z-5344003</td>
|
||||
<td align="center" height="38">WASHINGTON, DC</td>
|
||||
<td align="center">WINSTON SALEM, NC</td>
|
||||
<td align="center">332</td>
|
||||
<td align="center">2 / 3000</td>
|
||||
<td align="center">78x35x99 in.</td>
|
||||
<td align="center">LARGE STRAIGHT</td>
|
||||
<td align="center">31-Jan-2022 08:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344003"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td align="center" height="38">Z-5344092</td>
|
||||
<td align="center" height="38">Winchester, VA 22603</td>
|
||||
<td align="center">Milwaukee, WI 53221</td>
|
||||
<td align="center">728</td>
|
||||
<td align="center">4 / 2195</td>
|
||||
<td align="center">NO DIMENSIONS SPECIFIED</td>
|
||||
<td align="center">VAN</td>
|
||||
<td align="center">30-Jan-2022 15:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344092"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<td align="center" height="38">Z-5344035</td>
|
||||
<td align="center" height="38">ATLANTA, GA 30301</td>
|
||||
<td align="center">BURNSVILLE, MN 55337</td>
|
||||
<td align="center">1098</td>
|
||||
<td align="center">10 / 6000</td>
|
||||
<td align="center">48x40x40 in.</td>
|
||||
<td align="center">LARGE STRAIGHT</td>
|
||||
<td align="center">29-Jan-2022 08:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344035"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td align="center" height="38">Z-5344518</td>
|
||||
<td align="center" height="38">Hamlet, NC 28345</td>
|
||||
<td align="center">East Windsor, CT 06088</td>
|
||||
<td align="center">720</td>
|
||||
<td align="center">1 / 500</td>
|
||||
<td align="center">54x36x24in.</td>
|
||||
<td align="center">CARGO VAN</td>
|
||||
<td align="center">28-Jan-2022 13:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344518"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<td align="center" height="38">X-5344304</td>
|
||||
<td align="center" height="38">MOUNT PLEASANT, PA 15666</td>
|
||||
<td align="center">MIAMI, FL 33178-1056</td>
|
||||
<td align="center">1156</td>
|
||||
<td align="center">0 / 5000.00</td>
|
||||
<td align="center">48Inches x 48Inches x </td>
|
||||
<td align="center">Straight Truck 20-24 ft</td>
|
||||
<td align="center">28-Jan-2022 13:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344304"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td align="center" height="38">Z-5344061</td>
|
||||
<td align="center" height="38">Chesapeake, VA 23321</td>
|
||||
<td align="center">Fort Wayne, IN 46818</td>
|
||||
<td align="center">727</td>
|
||||
<td align="center">0 / 5000</td>
|
||||
<td align="center">NO DIMENSIONS SPECIFIED</td>
|
||||
<td align="center">LARGE STRAIGHT</td>
|
||||
<td align="center">28-Jan-2022 13:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344061"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<td align="center" height="38">B-5344514</td>
|
||||
<td align="center" height="38">MAXTON, NC 28364</td>
|
||||
<td align="center">PEMBINA, ND 58271</td>
|
||||
<td align="center">1637</td>
|
||||
<td align="center">7 / 28000</td>
|
||||
<td align="center">7@54x96x40</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">28-Jan-2022 12:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344514"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td align="center" height="38">Z-5344114</td>
|
||||
<td align="center" height="38">Durham, NC 27703</td>
|
||||
<td align="center">Cumming, GA 30040</td>
|
||||
<td align="center">368</td>
|
||||
<td align="center">6 / 3200</td>
|
||||
<td align="center">48x40x48in.</td>
|
||||
<td align="center">LARGE STRAIGHT</td>
|
||||
<td align="center">28-Jan-2022 12:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344114"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<td align="center" height="38">Z-5344231</td>
|
||||
<td align="center" height="38">Durham, NC 27702</td>
|
||||
<td align="center">Cumming, GA 30040</td>
|
||||
<td align="center">366</td>
|
||||
<td align="center">6 / 3200</td>
|
||||
<td align="center">48x40x48in.</td>
|
||||
<td align="center">LARGE STRAIGHT</td>
|
||||
<td align="center">28-Jan-2022 12:00:00</td>
|
||||
<td align="center"><!--thickbox-->
|
||||
<a title="Do Bidding" href="https://www.fastexact.com/secure/index.php?page=doBidding&job_id=5344231"><img src="https://www.fastexact.com/site_manager/images/icons/view.jpg" border="0" title="View this Record" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
<div class="paging">
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Details Found: 81<img height="1" width="14" alt="" src="images/tspacer.gif">Page 1 of 9</td>
|
||||
<td align="center"><div id="Page">
|
||||
<img height="1" width="8" alt="" src="images/tspacer.gif">
|
||||
<a href="javascript:fnPaging('pageNum=2&records_per_page=10&zipcode=27006&distance=300&st_loc_zip=8')">Next</a> <strong>»</strong>
|
||||
</div></td>
|
||||
<td align="right"><table cellspacing="0" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" class="record">Records Per Page: </td>
|
||||
<td valign="top"><div id="recNum">
|
||||
<select style="font-size: 11px;" class="dropdown" id="pagei" name="pagei" onchange="changeRecordCount('27006','300','8')">
|
||||
<option value="10" selected="selected" >10</option>
|
||||
<option value="20" >20</option>
|
||||
<option value="50" >50</option>
|
||||
<option value="100" >100</option>
|
||||
</select>
|
||||
</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
Loading…
Reference in New Issue