{"id":20115583,"url":"https://github.com/mutualmobile/afharchiver","last_synced_at":"2025-05-06T13:33:01.935Z","repository":{"id":6565460,"uuid":"7807365","full_name":"mutualmobile/AFHARchiver","owner":"mutualmobile","description":"An AFNetworking extension to automatically generate HTTP Archive files of all of your network requests!","archived":false,"fork":false,"pushed_at":"2022-10-21T08:29:55.000Z","size":874,"stargazers_count":102,"open_issues_count":2,"forks_count":14,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-04-14T15:20:25.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mutualmobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-24T21:16:05.000Z","updated_at":"2022-10-21T08:28:39.000Z","dependencies_parsed_at":"2022-09-13T22:52:09.631Z","dependency_job_id":null,"html_url":"https://github.com/mutualmobile/AFHARchiver","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mutualmobile%2FAFHARchiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mutualmobile%2FAFHARchiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mutualmobile%2FAFHARchiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mutualmobile%2FAFHARchiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mutualmobile","download_url":"https://codeload.github.com/mutualmobile/AFHARchiver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224505618,"owners_count":17322638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T18:35:46.611Z","updated_at":"2024-11-13T18:35:47.376Z","avatar_url":"https://github.com/mutualmobile.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"AFHARchiver\n===============================\n\nAn [AFNetworking](https://github.com/AFNetworking/AFNetworking/) extension to automatically generate a HTTP Archive file of all of your network requests!\n\n## Overview\nWhat is HTTP Archiving (HAR)? It's a specification that allows you to store HTTP request/responses as well as meta data, and view that information at a later time to help with debugging.\n\nYou can find the HAR specification [here](http://www.softwareishard.com/blog/har-12-spec/), and you can find an online HAR viewer [here](http://www.softwareishard.com/har/viewer/). You can download a sample HAR log from [here](http://mutualmobile.github.com/AFHARchiver/files/01-16-2013_02_24_30_log.HAR) and drag it into the online viewer to take a look.\n\nThere is also a long list of tools that support the HAR format [here](http://www.softwareishard.com/blog/har-adopters/).\n\nThe full spec has not been fully implemented yet, but basic timing information has been included. By releasing this to the community, we are hopeful more advanced logging data will be implemented.\n\n## How to use the HARchiver\n\nUsing a HARchiver is as simple as creating an instance of it, and telling it to start. The archiver will archive requests as they come in directly to disk at the path you specify.\n\n``` objective-c\nNSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\nNSString *documentsDirectory = [paths objectAtIndex:0];\nNSString *filePath = [documentsDirectory stringByAppendingPathComponent:@\"log.har\"];\n\nself.afArchiver = [[AFHARchiver alloc] initWithPath:filePath error:nil];\n[self.afArchiver startArchiving];\n```\n\n## Archiving Specific AFHTTPRequestOperations / NSURLSessionTasks\n\nYou will most likely run into a scenario where you only want to archive specific operations. The most common use has been to ignore logging image files to prevent your archive from growing too large in size. For AFHTTPRequestOperations, you can use \u003ctt\u003esetShouldArchiveOperationBlock:\u003c/tt\u003e. For NSURLSessionTasks, you can use \u003ctt\u003esetShouldArchiveTaskBlock:\u003c/tt\u003e.\n\n``` objective-c\n[self.afArchiver\n setShouldArchiveOperationBlock:^BOOL(AFHTTPRequestOperation *operation) {\n     return [operation.responseSerializer isKindOfClass:[AFJSONResponseSerializer class]];\n }];\n \n[self.afArchiver\n setShouldArchiveTaskBlock:^BOOL(NSURLSessionTask *task, id\u003cAFURLResponseSerialization\u003e responseSerializer, id serializedResponse) {\n     return [(NSObject*)responseSerializer isKindOfClass:[AFJSONResponseSerializer class]];\n }];\n}];\n```\n\n##Using AFNetworking 2.0.0, iOS 6, and NSURLConnection\n\nIf your application is using AFNetworking 2.0.0, targeting iOS 6, and using the NSURLConnection API's, continue to use AFHARchiver 0.1.0. The current version of AFHARchiver requires the AF/NSURLSession API's included in AFNetworking 2.0.0.\n\n## A Few TODO's\n\nThere is some advanced functionality that has not yet been implemented that will lead to more advanced logs. These include the following:\n* Split the **duration** of the request into the proper time buckets. Currently all time is passed to the duration bucket.\n* Determine if responses are returning from a local cache using the **cache** property.\n* Log all cookie information to the **cookie** property.\n* Calculate the correct **headerSize**.\n\n## Credits\n\nCreated by Kevin Harwood ([Email](kevin.harwood@mutualmobile.com) | [Twitter](https://twitter.com/kevinharwood)) at [Mutual Mobile](http://mutualmobile.com).\n\n## License\n\nAFHARchiver is available under the MIT license. See the LICENSE file for more info\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmutualmobile%2Fafharchiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmutualmobile%2Fafharchiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmutualmobile%2Fafharchiver/lists"}