Splitting an OWIN MidFunc

162 views
Skip to first unread message

Ryan Riley

unread,
Feb 9, 2015, 12:19:34 AM2/9/15
to net-http-a...@googlegroups.com
I'm trying to find a way to split an OWIN MidFunc into its inbound and outbound parts. Does anyone have any thoughts as to how to do this? The goal is to split the MidFunc so that I can create two pieces I can compose independently. I think most MidFuncs typically do something on only inbound or outbound, but I don't know of anyway to verify this for a given MidFunc.

For anyone who wants to know why I might want to do such a thing, feel free to ask questions here: https://github.com/freya-fs/freya/issues/28

Sebastien Lambla

unread,
Feb 9, 2015, 1:11:27 AM2/9/15
to net-http-a...@googlegroups.com
Func<AppFunc,AppFunc,AppFunc,MidFunc>?

I uses to habe a pipeline of before and after in OpenRasta. The complexities did end up overwhelming. 

Sent from my iPad

On 9 Feb 2015, at 05:19, Ryan Riley <ryan....@panesofglass.org> wrote:

I'm trying to find a way to split an OWIN MidFunc into its inbound and outbound parts. Does anyone have any thoughts as to how to do this? The goal is to split the MidFunc so that I can create two pieces I can compose independently. I think most MidFuncs typically do something on only inbound or outbound, but I don't know of anyway to verify this for a given MidFunc.

For anyone who wants to know why I might want to do such a thing, feel free to ask questions here: https://github.com/freya-fs/freya/issues/28

--
You received this message because you are subscribed to the Google Groups "OWIN working group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-http-abstrac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Riley

unread,
Feb 9, 2015, 10:05:32 AM2/9/15
to net-http-a...@googlegroups.com
On Monday, February 9, 2015 at 12:11:27 AM UTC-6, SerialSeb wrote:
Func<AppFunc,AppFunc,AppFunc,MidFunc>?

That looks like a conversion from your pipeline to a MidFunc. Is that right? I'm trying to go the other way and consume a MidFunc into my pipeline. Looking harder, I don't think it possible. :(

Sebastien Lambla

unread,
Feb 9, 2015, 10:08:34 AM2/9/15
to net-http-a...@googlegroups.com
If you pass a next at composition time that you control as a marker, you
could call the beforenext, then do what you want, and call the afternext
once you signal the next?

To unroll, you need to compose your midfunc with an awaitable appfunc and
return two appfuncs, before and after, but I don’t see how you would ever
call only after.

That is, if I understand what you’re trying to do :)

Ryan Riley

unread,
Feb 9, 2015, 10:13:40 AM2/9/15
to net-http-a...@googlegroups.com
On Monday, February 9, 2015 at 9:08:34 AM UTC-6, SerialSeb wrote:
If you pass a next at composition time that you control as a marker, you
could call the beforenext, then do what you want, and call the afternext
once you signal the next?

To unroll, you need to compose your midfunc with an awaitable appfunc and
return two appfuncs, before and after, but I don’t see how you would ever
call only after.

That is, if I understand what you’re trying to do :)

Ah, cheers! I get it now!
Reply all
Reply to author
Forward
0 new messages