accept say in headers for more length

master v0.1.5
bel 2023-03-26 09:25:48 -06:00
parent ad967d5047
commit 67e504ced6
2 changed files with 6 additions and 1 deletions

View File

@ -80,6 +80,9 @@ func (v01 *V01) globalQueries(r *http.Request) {
func (v01 *V01) globalQuerySay(r *http.Request) { func (v01 *V01) globalQuerySay(r *http.Request) {
text := r.URL.Query().Get("say") text := r.URL.Query().Get("say")
if text == "" {
text = r.Header.Get("say")
}
if text == "" { if text == "" {
return return
} }

View File

@ -170,7 +170,9 @@ func TestV01Feedback(t *testing.T) {
resp.Body.Close() resp.Body.Close()
} }
time.Sleep(time.Millisecond * 2500) time.Sleep(time.Millisecond * 2500)
resp, err := http.Get("http://localhost:27071/?say=URL%20encoding%2C%20also%20known%20as%20percent%20encoding%2C%20is%20a%20way%20to%20encode%20or%20escape%20reserved%2C%20unprintable%2C%20or%20non-ASCII%20characters%20in%20URLs%20to%20a%20safe%20and%20secure%20format") r, _ := http.NewRequest(http.MethodGet, "http://localhost:27071", nil)
r.Header.Set("say", "No, HTTP does not define any limit. However most web servers do limit size of headers they accept. For example in Apache default limit is 8KB, in IIS it's 16K. Server will return 413 Entity Too Large error if headers size exceeds that limit.")
resp, err := http.DefaultClient.Do(r)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }