Giter Site home page Giter Site logo

kasketis / netfox Goto Github PK

View Code? Open in Web Editor NEW
3.6K 57.0 360.0 8.46 MB

A lightweight, one line setup, iOS / OSX network debugging library! 🦊

License: MIT License

Swift 98.82% Ruby 0.82% Objective-C 0.36%
networking debugging urlsession urlrequest urlprotocol request response swift xcode certificate-pinning

netfox's People

Contributors

abeansits avatar adelinofaria avatar bd-jhunter avatar chrispix avatar dannypier avatar felipeflorencio avatar freak4pc avatar janglinator avatar jasoncabot avatar jasonlagaac avatar kasketis avatar krzysztofpelczarinfullmobile avatar matt-freedmanpi avatar maxvodafone avatar michaelfransen avatar petrosdemetrakopoulos avatar petrprazak avatar seviu avatar simonrice avatar skychiarottoa avatar sroebert avatar stefansuciu avatar tabynbayev1 avatar tanpengsccd avatar tbaranes avatar touyu avatar tzatzosm avatar vgubriienko avatar vincedev avatar vysotsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netfox's Issues

Add Travis CI?

Would you mind if I added a Travis config to this repo? I'll configure it to build against Swift 3.2 and 4.0, to make sure we don't cause build issues for anybody again.

Using Netfox without modal presentation

I've created a project where I having a large selection of debugging tools built into one debugging window. Netfox is spectacular, and I'd like to add it as another section of the pod. However I don't wish to present it modally, but rather push it onto my existing navigation controller. Is there any way we could publicly expose the NFXListController class for custom usage?

P.S. my library is in ObjC, so an @objc at the top would also be awesome!

Swift 3.0

Would love to see this update to Swift 3.0 to begin testing soon :)

Netfox & Parse: can't see my Parse requests

Not sure what could be the reason for that... Any idea?
I see other requests (such ax Mixpanel and Facebook graph) but not Parse ones.

But beside it - great idea and really really great and cool implematation!

Thanks a lot!!

NSURLSession not working (3rd party i.e.:Alamofire neither)

It's not catching requests/responses that go through Alamofire ("Equivalent" to AFNetworking in Swift)

Most basic case:

let request = ...
Alamofire.Manager.sharedInstance.request(request).validate().responseJSON() { 
...
}

My guessing is that it's not working for any NSURLSession request, this is not working either:

let request = NSURLRequest(URL: url)
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { data, response, error in

Filter by type

Can we make a method to configure Netfox to ignore certain types of requests or url extensions?

I'm thinking about an app that loads many images, and we just want the main interaction between app <=> server and not those resources.

Dissmiss Button

Please add Dissmiss Button, because i use shake gesture for other stuff

How do I use with Objective-C project

I am not sure how to use this framework with an Objective C project? Should there be a bridging header included in the framework, or do I need to somehow create one in xCode?

Thanks.

OSX support

Starting a first suggestion in #28 for OSX support, you seemed to be interested in it. Is there any work started yet? If no, would you be interested in a PR to handle it? (if I have the time to work on it...) Or just some helps?

We are really interested on this since we already using Netfox in our iOS application :)

Crash "configForObject"

This method is crashing, you should never unwrap variables without using 'guard' or 'if let' or define a default value

func configForObject(obj : NFXHTTPModel)
{

...

    setStatus(obj.responseStatus!)
    setTimeInterval(obj.timeInterval!)
    setRequestTime(obj.requestTime!)
    setType(obj.responseType!)
    setMethod(obj.requestMethod!)
}

I propose not using them if they're not present and handle those cases, or simplest way:

    setStatus(obj.responseStatus ?? 999)
    setTimeInterval(obj.timeInterval ?? "-")
    setRequestTime(obj.requestTime ?? "-")
    setType(obj.responseType ?? "-")
    setMethod(obj.requestMethod ?? "-")

You're the father, your call :D

Override/Change gesture/Way to show logs

It would be nice to have the ability to define our own method/gesture and call everything with one access method. Imagine this mixes up with shaking in some application, or we want to have a button always there to just display when the tester taps, etc.

Thanks!

SSL pinning support

Hello, I think it'll be very useful to have an ability to use netfox with server with SSL pinning. Nowadays many apps avoid security issues, so they have pinning switched on connected server.

Any thoughts?

netfox UI doesnt show up

Hi,

I am using netfox in my project and I have been facing weird situation. After changing the account -which is logging out and signing in again- netfox UI does not show up both in simulator and device in debug mode. After shaking again, it closes my main.storyboard and opens up my login view controller which is in another storyboard. Maybe it does not have anything with netfox but I just wanted to ask you guys, I do not know how to figure out what causes this and you know maybe you can help. Any thougths?

No HTTP body for requests

All requests that send data show as "Request body is empty" for the request body despite having the correct Content-Length set in the header

The reason is because when startLoading() is called in NFXProtocol the getNFXBody() is nil

I believe this is the same issue as:

https://github.com/AliSoftware/OHHTTPStubs/wiki/Testing-for-the-request-body-in-your-stubs

I'm currently seeing if there's a different place to trap and save this data

I'm also using Alamofire but I'm not sure it's related to that

No longer supported

My coworkers and myself LOVE Netfox. However the last commit was made 4 months ago. I'd love to support it, is there any way I may have write access?

Thanks!

Remote Logging

This is REALLY useful for individual testing and debugging. It would be even better if when this is enabled it would post logs to a database periodically. Could be Dynamo, Elasticsearch, Mongo etc. This would allow broader profiling among Test and Beta users. Its important to understand your API consumption so you don't put out an app thats going to blow your API quota or violate a 3rd Party TOS and this could do that easily I think.

Is it AppStore safe?

Are you using any private API's or anything that apple would find a reason to reject the app?

Request body is empty

On the request details screen, request body is empty, but it filled in URLRequest.httpBody

Encryption?

More of a mental note, but we should be using encryption in our storage of these request bodies, if we're not already.

Large increase in memory usage with netfox enabled

I have an app which is doing somewhat large JSON imports very often in the background, like every 8-20s. The JSONs are parsed and saved into Core Data, all on the same backgorund thread/MOC.

With netfox compiled in, the memory usage became very large.
I was not aware of at first that netfox is the cause of this, so I was removing my background operations one my one until I was left with just one call. Without netfox, app would take 40-44MB. With netfox, it was 84MB. When I added another JSON call following the first one, without netfox memory usage was around 54MB, with netfox it was 150MB. This was all without netfox UI ever being triggered - it was just doing its thing in the background.

If it helps - both of these JSON calls cause reading/updating and creating a lot of NSManagedObjects from my Core Data store. This all happens in background MOC/thread, thus it's gone from memory as soon as it's processed. But if netfox is somehow keeping something from that thread retained, then it could be a reason that all of the objects from the thread are staying in memory.

My app is Objective-C based and I really don't know Swift thus can't help debugging this.
Still, though it's worth reporting this.

Requests don't show for applications that use a custom NSURLSessionTask

I was seeing some of my frameworks requests but I wasn't seeing them from my own app. I did some debugging and found that if your app uses a NSURLSessionConfiguration class and uses NSUrlSessionTasks, you must set the protocol class yourself.

Also, in NFXProtocol, you must implement the following method.

override public class func canInitWithTask(task: NSURLSessionTask) -> Bool {
        if !NFX.sharedInstance().isEnabled() {
            return false
        }

        if let url = task.currentRequest?.URL {
            if (!(url.absoluteString.hasPrefix("http")) && !(url.absoluteString.hasPrefix("https"))) {
                return false
            }

            for ignoredURL in NFX.sharedInstance().getIgnoredURLs() {
                if url.absoluteString.hasPrefix(ignoredURL) {
                    return false
                }
            }
        } else {
            return false
        }

        if NSURLProtocol.propertyForKey("NFXInternal", inRequest: task.currentRequest!) != nil {
            return false
        }

        return true
    }

I will try to get around to making a pull request, but I wanted to post this in case other people weren't seeing all of their traffic.

Caching broken with Netfox protocol

When creating a custom manager to work with Alamofire:

    static let sharedManager: TIFAlamofireManager = {
        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        configuration.protocolClasses?.insert(NFXProtocol.self, atIndex: 0)
        configuration.HTTPAdditionalHeaders = Manager.defaultHTTPHeaders
        let manager = TIFAlamofireManager(configuration: configuration)
        manager.startRequestsImmediately = false
        return manager
    }()

The caching of URLRequests seems to be broken.

After disabling this line:

configuration.protocolClasses?.insert(NFXProtocol.self, atIndex: 0)

Caching works as expected.

Anyone else encountering this issue?

Build warnings

In NFXHTTPModel.swift, func prettyPrint (line 239)
return NSString(data: prettyPrintedString, encoding: String.Encoding.utf8.rawValue) as? String
should be
return NSString(data: prettyPrintedString, encoding: String.Encoding.utf8.rawValue) as String?

Issue with Carthage

I'm trying to use this with Carthage, but it doesn't work for me. I'm only building for iOS with:
carthage build --platform iOS

The issue is that the framework is defined as netfox_ios instead of netfox (and the same for the module name). Is there any way to make the framework and module name be "netfox" as with Cocoapods?

Crash in NFXProtocol's startLoading()

Even with the latest changes to Netfox, there still remains a rare crash in NFXProtocol's startLoading(), during client.URLProtocolDidFinishLoading(self).

EXC_BREAKPOINT (code=1, subcode=0x1815e97d0)

Call stack of crash:
Thread 10Queue : NSOperationQueue 0x12effa0a0 :: NSOperation 0x1300bf730 (QOS: LEGACY) (serial)
#0 0x00000001815e97d0 in _os_lock_corruption_abort ()
#1 0x00000001815e97d0 in _OSSpinLockLockSlow$VARIANT$wfe ()
#2 0x0000000181f7b570 in CFURLProtocol_NS::forgetProtocolClient() ()
#3 0x000000010019f038 in NFXProtocol.(startLoading() -> ()).(closure #1) at .../netfox/netfox/NFXProtocol.swift:89

It appears others doing NSURLProtocol work have this exact same crash. See this: https://forums.developer.apple.com/thread/26081

And see the threading rules mentioned in that discussion thread here: https://developer.apple.com/library/ios/samplecode/CustomHTTPProtocol/Listings/Read_Me_About_CustomHTTPProtocol_txt.html

Maybe someone with more experience with Netfox's code can research and fix this? I receive reports of this crash routinely via Crashlytics, and I just hit it again in a local build I was debugging today upon launch of my app, which is using current root source of netfox (6/15/16).

Proper casing in project naming

I've noticed that this is the only framework that I use that has the framework name lowercased. @kasketis - Was this intentional? Do you mind if we update it to Netfox instead of netfox?

Fix missing request body

As mentioned in the help docs, users have to manually write:

if let bodyData = mutableURLRequest.HTTPBody {
    NSURLProtocol.setProperty(bodyData, forKey: "NFXBodyData", inRequest: mutableURLRequest)
}

It would be spectacular if there was a way to do this internally using swizzling

Why is NFXProtocol internal?

Awesome little library! I wonder, though -- why is NFXProtocol internal? When importing this as a pod, I'm unable to create a custom NFXManager to support Alamofire.

New features

Hello folks,

I'm searching for new cool things to add in the next releases of netfox!

Please contribute your ideas here! :)

Using netfox with Moya

Moya uses Alamofire to make request but I couldn't figure out how I can embed NFXManager for Alamofire. Any suggestion?

Pretty Printing

Pretty printing request responses could be a very nice enhancement! Nice work, thank you.

Problem facing in integration with objective - c project.

Hi,

I am integrating netfox manually (by dragging the swift files folder in xcode). Xcode compiling it fine, but problem is how i can import them in my objective-c project. i even tried with this statement

import "netfox-Swift.h"

but it didn't worked for me and xcode is giving error that file not found. I am in middle of it please help.

Thanks.

Alternatives.

It seems the developer for this project has gone AWOL. Does anyone have an alternative? Or has someone taken over active development on a fork somewhere?

Format long responses

Is it possible to format long responses (the view that just shows all the response when it's too big to fit) with the prettyPrint option?

I saw that's a textfield and it's just loading a plain string.

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.