@@ -893,14 +893,14 @@ func TestMethodsNotAllowed(t *testing.T) {
893893 }{
894894 {
895895 url : fmt .Sprintf ("%s/bzz-list:/" , srv .URL ),
896- code : 405 ,
896+ code : http . StatusMethodNotAllowed ,
897897 }, {
898898 url : fmt .Sprintf ("%s/bzz-hash:/" , srv .URL ),
899- code : 405 ,
899+ code : http . StatusMethodNotAllowed ,
900900 },
901901 {
902902 url : fmt .Sprintf ("%s/bzz-immutable:/" , srv .URL ),
903- code : 405 ,
903+ code : http . StatusMethodNotAllowed ,
904904 },
905905 } {
906906 res , _ := http .Post (c .url , "text/plain" , bytes .NewReader ([]byte (databytes )))
@@ -958,62 +958,61 @@ func TestGet(t *testing.T) {
958958 uri : fmt .Sprintf ("%s/" , srv .URL ),
959959 method : "GET" ,
960960 headers : map [string ]string {"Accept" : "text/html" },
961- expectedStatusCode : 200 ,
961+ expectedStatusCode : http . StatusOK ,
962962 assertResponseBody : "Swarm: Serverless Hosting Incentivised Peer-To-Peer Storage And Content Distribution" ,
963963 verbose : false ,
964964 },
965965 {
966966 uri : fmt .Sprintf ("%s/" , srv .URL ),
967967 method : "GET" ,
968968 headers : map [string ]string {"Accept" : "application/json" },
969- expectedStatusCode : 200 ,
969+ expectedStatusCode : http . StatusOK ,
970970 assertResponseBody : "Swarm: Please request a valid ENS or swarm hash with the appropriate bzz scheme" ,
971971 verbose : false ,
972972 },
973973 {
974974 uri : fmt .Sprintf ("%s/robots.txt" , srv .URL ),
975975 method : "GET" ,
976976 headers : map [string ]string {"Accept" : "text/html" },
977- expectedStatusCode : 200 ,
977+ expectedStatusCode : http . StatusOK ,
978978 assertResponseBody : "User-agent: *\n Disallow: /" ,
979979 verbose : false ,
980980 },
981981 {
982982 uri : fmt .Sprintf ("%s/nonexistent_path" , srv .URL ),
983983 method : "GET" ,
984984 headers : map [string ]string {},
985- expectedStatusCode : 404 ,
985+ expectedStatusCode : http . StatusNotFound ,
986986 verbose : false ,
987987 },
988988 {
989989 uri : fmt .Sprintf ("%s/bzz:asdf/" , srv .URL ),
990990 method : "GET" ,
991991 headers : map [string ]string {},
992- expectedStatusCode : 404 ,
992+ expectedStatusCode : http . StatusNotFound ,
993993 verbose : false ,
994994 },
995995 {
996996 uri : fmt .Sprintf ("%s/tbz2/" , srv .URL ),
997997 method : "GET" ,
998998 headers : map [string ]string {},
999- expectedStatusCode : 404 ,
999+ expectedStatusCode : http . StatusNotFound ,
10001000 verbose : false ,
10011001 },
10021002 {
10031003 uri : fmt .Sprintf ("%s/bzz-rack:/" , srv .URL ),
10041004 method : "GET" ,
10051005 headers : map [string ]string {},
1006- expectedStatusCode : 404 ,
1006+ expectedStatusCode : http . StatusNotFound ,
10071007 verbose : false ,
10081008 },
10091009 {
10101010 uri : fmt .Sprintf ("%s/bzz-ls" , srv .URL ),
10111011 method : "GET" ,
10121012 headers : map [string ]string {},
1013- expectedStatusCode : 404 ,
1013+ expectedStatusCode : http . StatusNotFound ,
10141014 verbose : false ,
1015- },
1016- } {
1015+ }} {
10171016 t .Run ("GET " + testCase .uri , func (t * testing.T ) {
10181017 res , body := httpDo (testCase .method , testCase .uri , nil , testCase .headers , testCase .verbose , t )
10191018 if res .StatusCode != testCase .expectedStatusCode {
@@ -1060,37 +1059,37 @@ func TestModify(t *testing.T) {
10601059 uri : fmt .Sprintf ("%s/bzz:/%s" , srv .URL , hash ),
10611060 method : "DELETE" ,
10621061 headers : map [string ]string {},
1063- expectedStatusCode : 200 ,
1062+ expectedStatusCode : http . StatusOK ,
10641063 assertResponseBody : "8b634aea26eec353ac0ecbec20c94f44d6f8d11f38d4578a4c207a84c74ef731" ,
10651064 verbose : false ,
10661065 },
10671066 {
10681067 uri : fmt .Sprintf ("%s/bzz:/%s" , srv .URL , hash ),
10691068 method : "PUT" ,
10701069 headers : map [string ]string {},
1071- expectedStatusCode : 405 ,
1070+ expectedStatusCode : http . StatusMethodNotAllowed ,
10721071 verbose : false ,
10731072 },
10741073 {
10751074 uri : fmt .Sprintf ("%s/bzz-raw:/%s" , srv .URL , hash ),
10761075 method : "PUT" ,
10771076 headers : map [string ]string {},
1078- expectedStatusCode : 405 ,
1077+ expectedStatusCode : http . StatusMethodNotAllowed ,
10791078 verbose : false ,
10801079 },
10811080 {
10821081 uri : fmt .Sprintf ("%s/bzz:/%s" , srv .URL , hash ),
10831082 method : "PATCH" ,
10841083 headers : map [string ]string {},
1085- expectedStatusCode : 405 ,
1084+ expectedStatusCode : http . StatusMethodNotAllowed ,
10861085 verbose : false ,
10871086 },
10881087 {
10891088 uri : fmt .Sprintf ("%s/bzz-raw:/" , srv .URL ),
10901089 method : "POST" ,
10911090 headers : map [string ]string {},
10921091 requestBody : []byte ("POSTdata" ),
1093- expectedStatusCode : 200 ,
1092+ expectedStatusCode : http . StatusOK ,
10941093 assertResponseHeaders : map [string ]string {"Content-Length" : "64" },
10951094 verbose : false ,
10961095 },
@@ -1099,7 +1098,7 @@ func TestModify(t *testing.T) {
10991098 method : "POST" ,
11001099 headers : map [string ]string {},
11011100 requestBody : []byte ("POSTdata" ),
1102- expectedStatusCode : 200 ,
1101+ expectedStatusCode : http . StatusOK ,
11031102 assertResponseHeaders : map [string ]string {"Content-Length" : "128" },
11041103 verbose : false ,
11051104 },
@@ -1148,7 +1147,7 @@ func TestMultiPartUpload(t *testing.T) {
11481147 }
11491148 res , body := httpDo ("POST" , url , buf , headers , verbose , t )
11501149
1151- if res .StatusCode != 200 {
1150+ if res .StatusCode != http . StatusOK {
11521151 t .Fatalf ("expected POST multipart/form-data to return 200, but it returned %d" , res .StatusCode )
11531152 }
11541153 if len (body ) != 64 {
0 commit comments