elm-pages 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -159,10 +159,11 @@ async function render(event, context) {
159
159
  */
160
160
  function reqToJson(req) {
161
161
  return {
162
+ requestTime: Math.round(new Date().getTime()),
162
163
  method: req.httpMethod,
163
164
  headers: req.headers,
164
165
  rawUrl: req.rawUrl,
165
- body: req.body,
166
+ body: req.body || null,
166
167
  multiPartFormData: null,
167
168
  };
168
169
  }
@@ -1,3 +1,3 @@
1
1
  export const compatibilityKey = 20;
2
2
 
3
- export const packageVersion = "3.0.1";
3
+ export const packageVersion = "3.0.2";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elm-pages",
3
3
  "type": "module",
4
- "version": "3.0.1",
4
+ "version": "3.0.2",
5
5
  "homepage": "https://elm-pages.com",
6
6
  "moduleResolution": "node",
7
7
  "description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
@@ -41,19 +41,15 @@ fakeRequest =
41
41
 
42
42
  requestDecoder : Decode.Decoder RequestRecord
43
43
  requestDecoder =
44
- Decode.succeed RequestRecord
45
- |> andMap
46
- (Decode.field "requestTime"
47
- (Decode.int |> Decode.map Time.millisToPosix)
48
- )
49
- |> andMap (Decode.field "method" Decode.string)
50
- |> andMap (Decode.field "body" (Decode.nullable Decode.string))
51
- |> andMap
52
- (Decode.string
53
- |> Decode.field "rawUrl"
54
- )
55
- |> andMap (Decode.field "headers" (Decode.dict Decode.string))
56
- |> andMap
44
+ Decode.map6 RequestRecord
45
+ (Decode.field "requestTime"
46
+ (Decode.int |> Decode.map Time.millisToPosix)
47
+ )
48
+ (Decode.field "method" Decode.string)
49
+ (Decode.maybe (Decode.field "body" Decode.string))
50
+ (Decode.field "rawUrl" Decode.string)
51
+ (Decode.maybe (Decode.field "headers" (Decode.dict Decode.string)) |> Decode.map (Maybe.withDefault Dict.empty))
52
+ (Decode.maybe
57
53
  (Decode.field "headers"
58
54
  (optionalField "cookie" Decode.string
59
55
  |> Decode.map
@@ -62,6 +58,8 @@ requestDecoder =
62
58
  )
63
59
  )
64
60
  )
61
+ |> Decode.map (Maybe.withDefault Dict.empty)
62
+ )
65
63
 
66
64
 
67
65
  andMap : Decode.Decoder a -> Decode.Decoder (a -> b) -> Decode.Decoder b