Giter Club home page Giter Club logo

Comments (1)

richardbowden avatar richardbowden commented on September 18, 2024

I am interested in this feature, i need to change the content type and content encoding. I have been playing with GetResponseHeader from the original goaws/goaws lib, porting this function to this lib...

got this so far:

s3.go

func (b *Bucket) GetResponseWithHeaders(path string, headers map[string][]string) (data []byte, err error) {
    req := &request{
        bucket:  b.Name,
        path:    path,
        headers: headers,
    }
    fmt.Printf("**** initial headers: %v\n\n\n", req)
    err = b.S3.prepare(req)
    fmt.Printf("**** headers after prep: %v\n\n\n\n", req)
    if err != nil {
        return nil, err
    }
    for attempt := b.S3.AttemptStrategy.Start(); attempt.Next(); {
        resp, err := b.S3.run(req, nil)
        if shouldRetry(err) && attempt.HasNext() {
            continue
        }
        if err != nil {
            return nil, err
        }

        fmt.Printf("**** headers after get: %v\n\n\n", resp.Header)
        data, err = ioutil.ReadAll(resp.Body)
        resp.Body.Close()
        return data, nil
    }
    panic("unreachable")
} 

also added to S3 struct

aws.AttemptStrategy

this works, pulls back the data, how ever the headers do not seem to be sticking, on printing the headers, the last one shows the content type of the actual file being downloaded, not the one set...

still working on this.

from goamz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.