AlienVault-OTX / OTX-Go-SDK

A working client implementation for AlienVault OTX API written in Golang!
https://otx.alienvault.com
Apache License 2.0
55 stars 23 forks source link

use json.NewDecoder().Decode over ioutil.ReadAll() #5

Open bsmartt13 opened 8 years ago

bsmartt13 commented 8 years ago

its better for arbitrary stream decodes


    if v != nil {
        if w, ok := v.(io.Writer); ok {
            io.Copy(w, resp.Body)
        } else {
            err = json.NewDecoder(resp.Body).Decode(v)
        }
    }