Git Product home page Git Product logo

Comments (5)

AnthonyMDev avatar AnthonyMDev commented on July 24, 2024 1

@sbhklr I've pushed some changes to develop that I believe will fix this issue. I am trying a different approach to what you've done in #37.

There is now a responseS3MetaData serialization method that can be used.

I was unable to reproduce the crash. Could you confirm if this fixes the crash you are experiencing or not?

Thanks.

from amazons3requestmanager.

sebromero avatar sebromero commented on July 24, 2024

Your changes indeed fix it. A couple of notes:

  • Shouldn't the initializer of S3ObjectMetaData return nil in case there are no headers available?
  • Shouldn't the completion handler be of type completionHandler: Response<S3ObjectMetaData, NSError> -> Void because Result.value already returns an optional type. Otherwise I'd need to call it like if let metaData = response.result.value?!.metaData {} Suggestion:
public func responseS3MetaData(completionHandler: Response<S3ObjectMetaData, NSError> -> Void) -> Self {
    return response(responseSerializer: Request.s3MetaDataResponseSerializer(), completionHandler: completionHandler)
}

static func s3MetaDataResponseSerializer() -> ResponseSerializer<S3ObjectMetaData, NSError> {
    return ResponseSerializer { request, response, data, error in
        guard error == nil else { return .Failure(error!) }

        guard let response = response, metaData = S3ObjectMetaData(response: response) else {
            let failureReason = "No response data was found."
            let error = Error.errorWithCode(.DataSerializationFailed, failureReason: failureReason)
            return .Failure(error)
        }

        return .Success(metaData)
    }
}

from amazons3requestmanager.

AnthonyMDev avatar AnthonyMDev commented on July 24, 2024

Glad to hear this fixed the issue.

I'm sort of alright with the meta data being empty, but I can see your argument. I'll make that change as well. Hold tight. New version on the way.

I agree with your second point. I'm making a change right now to fix this. I'm also doing the same thing with the data serializer currently, so I'm going to fix that. This will cause minor API breaking changes.

from amazons3requestmanager.

sebromero avatar sebromero commented on July 24, 2024

👍 Alrighty. I'll update the PRs accordingly.

from amazons3requestmanager.

AnthonyMDev avatar AnthonyMDev commented on July 24, 2024

Pushing the new version right now. Thanks for your comments and your initial PR on this. If the new version does not fix the issue, please feel free to re-open this issue.

from amazons3requestmanager.

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.