Skip to content

v3.1

Latest

Choose a tag to compare

@pimbrouwers pimbrouwers released this 27 Jul 17:19
· 526 commits to master since this release
b7d334f

webHost Builder Improvements

In previous versions, the minimalistic web host builder allowed devs to get running quickly and when needed enabled full customization via the configure custom operation. This meant that anything beyond a toy project, required a fair amount of repetitive boilerplate setup code.

To combat this, several custom operations have been added, which semantically match the relevant area (i.e., add_service for services, use_middleware for middleware). The goal is to avoid the need to engage in a full-fledged configuration, although the configure method still exists which will override all other customizations which also creates a kind backward compatibility.

In addition, many common operations have been explicitly mapped: use_static_files, use_https, use_compression etc.

An example of the new builder in action can be found in the docs or samples.

configuration Builder Added

A thin wrapper around ConfigurationBuilder exposing a clean API for reading configuration values.

open Falco.HostBuilder

[<EntryPoint>]
let main args =    
    let env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")
    
    let config = configuration args {
        add_env
        required_json "appsettings.json"
        optional_json (String.Concat([|"appsettings."; env; ".json"|]))
    }

Utility Additions

  • StringUtils.stringf
  • StringUtils.strSplit
  • CookieCollectionReader
  • Auth.getClaimValue
  • Auth.hasScope

New Request functionality

  • Request.getCookie
  • Request.tryBindCookie
  • Request.streamForm
  • Request.tryBindFormStream

New Request HttpHandler's

  • Request.mapCookie
  • Request.bindCookie
  • Request.ifAuthenticatedWithScope

New Request HttpHandler's for streaming multipart data

Two particular fundamental handlers have been added to the Request module, to support multipart form data streaming for large uploads which Microsoft defines large uploads as anything > 64KB.

  • Request.bindFormStream
  • Request.bindFormStreamSecure
  • Request.mapFormStream
  • Request.mapFormStreamSecure

New Response HttpHandler's

Handlers have been added to support binary responses, both inline and attachment. Both asynchronously buffer data into the response body.

  • Response.ofBinary
  • Response.ofAttachment