Closed tobinharris closed 10 years ago
We struggled to find a solution for serving SVG image assets using CocoaHTTPServer. Eventually did this which worked well...
Basically we added this to the top of our view controller, although the monkey patch could be put somewhere more sensible :)
@interface HTTPFileResponse (Svg) @end @implementation HTTPFileResponse (Svg) - (NSDictionary *)httpHeaders { //HTTPLogTrace(); if ([[filePath pathExtension] isEqualToString:@"svg"]) { return [NSDictionary dictionaryWithObject:@"image/svg+xml" forKey:@"Content-Type"]; } return [NSDictionary new]; } @end
Closing.
After u create the category insert
below
We struggled to find a solution for serving SVG image assets using CocoaHTTPServer. Eventually did this which worked well...
Basically we added this to the top of our view controller, although the monkey patch could be put somewhere more sensible :)