Codebase list golang-github-parnurzeal-gorequest / ada8f51
forgot to run gofmt Stephen Young 7 years ago
1 changed file(s) with 14 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
347347 const case22_send_byte_int = "/send_byte_int"
348348 const case22_send_byte_int_pointer = "/send_byte_int_pointer"
349349 const case23_send_duplicate_query_params = "/send_duplicate_query_params"
350 const case24_send_query_and_request_body = "/send_query_and_request_body"
350 const case24_send_query_and_request_body = "/send_query_and_request_body"
351351
352352 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
353353 // check method is POST before going to check other features
481481 if values["param"][0] != "4" || values["param"][1] != "3" || values["param"][2] != "2" || values["param"][3] != "1" {
482482 t.Error("Expected Body with 4 params and values", "| but got", sbody)
483483 }
484 case case24_send_query_and_request_body:
485 t.Logf("case %v ", case24_send_query_and_request_body)
486 defer r.Body.Close()
487 body, _ := ioutil.ReadAll(r.Body)
484 case case24_send_query_and_request_body:
485 t.Logf("case %v ", case24_send_query_and_request_body)
486 defer r.Body.Close()
487 body, _ := ioutil.ReadAll(r.Body)
488488 sbody := string(body)
489 if sbody != `{"name":"jkbbwr"}` {
489 if sbody != `{"name":"jkbbwr"}` {
490490 t.Error(`Expected Body "{"name":"jkbbwr"}"`, "| but got", sbody)
491491 }
492492
493 v := r.URL.Query()
494 if v["test"][0] != "true" {
493 v := r.URL.Query()
494 if v["test"][0] != "true" {
495495 t.Error("Expected test:true", "| but got", v["test"][0])
496496 }
497497 }
646646 Send("param=3&param=4").
647647 End()
648648
649 data24 := struct{Name string `json:"name"`}{"jkbbwr"}
650 New().Post(ts.URL + case24_send_query_and_request_body).
649 data24 := struct {
650 Name string `json:"name"`
651 }{"jkbbwr"}
652 New().Post(ts.URL + case24_send_query_and_request_body).
651653 Query("test=true").
652654 Send(data24).
653655 End()
16011603 defer ts.Close()
16021604
16031605 New().Get(ts.URL).AddCookies([]*http.Cookie{
1604 &http.Cookie{Name: "API-Cookie-Name1", Value: "api-cookie-value1"},
1605 &http.Cookie{Name: "API-Cookie-Name2", Value: "api-cookie-value2"},
1606 {Name: "API-Cookie-Name1", Value: "api-cookie-value1"},
1607 {Name: "API-Cookie-Name2", Value: "api-cookie-value2"},
16061608 }).End()
16071609 }
16081610