OpenResty + multipart/form-data MINE type

By default multipart/form-data can't be processed by OpenResty and we need to pre process each request to be able to obtain the sent data.

At Moltin we create a library based on the idea behind Mashape guys, their library Mashape/lua-multipart but using Yichun Zhang library openresty/lua-resty-upload as base, because is optimized for OpenResty as and is 100% noblocking behaviour.

Note: Our library is just a wrapper for openresty/lua-resty-upload

This first iteration of the library is much simplier than the Mashape ones and just allowing us do decode the request returning a table to access the data.

This is how we could use it:

local multipart = require "multipart"  
local multipart_data = multipart()  
local data = multipart_data:get()  

And that's how our data will looks like after being parsed if we do the following request:

{
  param1 = "data1",
  param2 = "data2",
  param3 = "data3"
}

Note: That our library is private at the moment and eventually it will be public

Resources