Headers are always missing
tanis2000 opened this issue · 3 comments
tanis2000 commented
This line: https://github.com/olebedev/gojax/blob/master/fetch/fetch.go#L55 is always returning false for ok, thus not passing any of the headers.
tanis2000 commented
Here's my solution, it's damn ugly but it works, just change the o[headers]
check with the following and remove the comments as they're just for debug:
if h, ex := o["headers"]; ex {
fmt.Println("*** Headers map ***")
fmt.Println(h)
if hea, okh := h.(map[string]interface{}); okh {
fmt.Println("*** okh map ***")
fmt.Println(hea)
for key, value := range hea {
fmt.Println("*** hea map ***")
v := value.([]interface{})
for _, item := range v {
fmt.Println("*** item ***")
var i []string
i = append(i, item.(string))
header[textproto.CanonicalMIMEHeaderKey(key)] = i
fmt.Print("Header key/value")
fmt.Println(key)
fmt.Println(value)
}
}
}
}
olebedev commented
Hi @tanis2000,
thanks! A PR w/o debug output would be great.