Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

AFImageRequestOperation tweaks#896

Closed
jam wants to merge 3 commits intoAFNetworking:masterfrom
jam:master
Closed

AFImageRequestOperation tweaks#896
jam wants to merge 3 commits intoAFNetworking:masterfrom
jam:master

Conversation

@jam
Copy link
Copy Markdown

@jam jam commented Apr 5, 2013

This pull request fixes a couple of issues I was having when using AFImageRequestOperation.

  • One of the servers my app tried to connect to was returning JPEG images with a content type of image/jpg. While technically incorrect, this caused the operation to fail, which isn't desirable behaviour. Unfortunately the server isn't one I control, otherwise I'd have made the change on the server side.
  • While attempting to subclass AFImageRequestOperation to include the invalid type, I noticed that imageRequestOperationWithRequest:imageProcessingBlock:success:failure: always returned AFImageRequestOperation instances, rather than instances of the current class (like the other request operation classes).

James Clarke added 3 commits April 4, 2013 18:59
…convenience class method.

This enables using the method with subclasses.
This is technically incorrect, as "image/jpg" is not a valid MIME type, but certain web servers return this type for JPEG images which causes AFImageRequestOperation to fail.
@mattt
Copy link
Copy Markdown
Contributor

mattt commented Apr 6, 2013

Thanks for submitting this pull request, @jam.

You're absolutely correct to fix the use of an explicit class instead of self in the class methods. Every other subclass in AFNetworking core does this except AFImageRequestOperation, until ab00b95. I credited you for the patch, which combines the two you had, and adds a cast, for consistency.

As for adding the acceptable content type, there is a class method for just that purpose (which means that you didn't have to subclass to begin with): AFHTTPRequestOperation +addAcceptableContentTypes:.

@mattt mattt closed this Apr 6, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants