wai-extra-2.1.0.1: Provides some basic WAI handlers and middleware.

Portabilityportable
StabilityUnstable
MaintainerMichael Snoyman <michael@snoyman.com>
Safe HaskellNone

Network.Wai.Middleware.Jsonp

Description

Automatic wrapping of JSON responses to convert into JSONP.

Synopsis

Documentation

jsonp :: MiddlewareSource

Wrap json responses in a jsonp callback.

Basically, if the user requested a "text/javascript" and supplied a "callback" GET parameter, ask the application for an "application/json" response, then convert that into a JSONP response, having a content type of "text/javascript" and calling the specified callback function.