Middleware in Mixed mode trunk the response

18 views
Skip to first unread message

Alex Soto

unread,
Jan 23, 2018, 10:17:27 AM1/23/18
to hoverfly

Hi,

I am developing an extension to hide some sensitive data. Currently, I am trying a really simple example with modify mode.

I got next code:

payload = sys.stdin.readlines()[0]
    try:
        hoverflyResponse = json.loads(payload)

        if (hoverflyResponse['response']['status'] > 0):
            hoverflyResponse['response']['body'] = "{'foo': 'baz'}\n"
            print(json.dumps(hoverflyResponse))

    except Exception, err:
        print payload

But when I do curl --proxy http://localhost:8500 http://localhost:8080/cart I got:

{'foo': 'baz'}
curl: (18) transfer closed with 817 bytes remaining to read

Any idea if there is a bug in middleware with modify mode or am I doing something wrong?

Thanks

Alex Soto

unread,
Jan 23, 2018, 11:34:46 AM1/23/18
to hoverfly
Found the problem, it is in header.

El dimarts, 23 gener de 2018 16:17:27 UTC+1, Alex Soto va escriure:

Tommy Situ

unread,
Jan 23, 2018, 12:59:50 PM1/23/18
to Alex Soto, hoverfly
Nice! I can’t think of an easy way to debug middleware apart from adding lots of print to console. 

Sounds like you are doing data masking, what are you up to with Hoverfly?


Thanks, 
Tommy

--
You received this message because you are subscribed to the Google Groups "hoverfly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoverfly+u...@specto.io.
To post to this group, send email to hove...@specto.io.
To view this discussion on the web visit https://groups.google.com/a/specto.io/d/msgid/hoverfly/0be6c277-35d8-48bb-a3ae-329655ffd51b%40specto.io.

john.davenport

unread,
Jan 24, 2018, 6:27:46 AM1/24/18
to hoverfly
Hi, as it's python and as the interface is effectively stdin/stdout it should be possible to inject and assert using a simple framework?
Reply all
Reply to author
Forward
0 new messages