Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Attach source maps to httpRequest and httpResponse
Browse files Browse the repository at this point in the history
Closes #259
  • Loading branch information
kylef committed Apr 1, 2016
1 parent a10ba16 commit 65176e8
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 6 deletions.
66 changes: 66 additions & 0 deletions features/fixtures/refract.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,17 @@
},
"content": "<request name>"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
1039,
37
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down Expand Up @@ -807,6 +818,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
1242,
27
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down Expand Up @@ -1025,6 +1047,17 @@
},
"content": "<request name>"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
1039,
37
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down Expand Up @@ -1221,6 +1254,17 @@
},
"content": "201"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
1438,
14
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down Expand Up @@ -1411,6 +1455,17 @@
},
"content": "<request name>"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
1039,
37
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down Expand Up @@ -1607,6 +1662,17 @@
},
"content": "201"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
1479,
32
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
42 changes: 42 additions & 0 deletions features/fixtures/refract.sourcemap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ content:
- 1039
- 37
content: "<request name>"
sourceMap:
-
element: "sourceMap"
content:
-
- 1039
- 37
headers:
element: "httpHeaders"
content:
Expand Down Expand Up @@ -520,6 +527,13 @@ content:
- 1242
- 27
content: "200"
sourceMap:
-
element: "sourceMap"
content:
-
- 1242
- 27
headers:
element: "httpHeaders"
content:
Expand Down Expand Up @@ -661,6 +675,13 @@ content:
- 1039
- 37
content: "<request name>"
sourceMap:
-
element: "sourceMap"
content:
-
- 1039
- 37
headers:
element: "httpHeaders"
content:
Expand Down Expand Up @@ -788,6 +809,13 @@ content:
- 1438
- 14
content: "201"
sourceMap:
-
element: "sourceMap"
content:
-
- 1438
- 14
headers:
element: "httpHeaders"
content:
Expand Down Expand Up @@ -910,6 +938,13 @@ content:
- 1039
- 37
content: "<request name>"
sourceMap:
-
element: "sourceMap"
content:
-
- 1039
- 37
headers:
element: "httpHeaders"
content:
Expand Down Expand Up @@ -1037,6 +1072,13 @@ content:
- 1479
- 32
content: "201"
sourceMap:
-
element: "sourceMap"
content:
-
- 1479
- 32
headers:
element: "httpHeaders"
content:
Expand Down
2 changes: 2 additions & 0 deletions src/RefractAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ namespace drafter {
}
}

AttachSourceMap(element, payload);

// If no payload, return immediately
if (payload.isNull()) {
element->set(content);
Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/api/action-attributes.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,18 @@
]
},
"content": "200"
}
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
109,
14
]
]
}
]
},
"content": [
{
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/action-parameters.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
137,
33
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/api/action.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,18 @@
]
},
"content": "200"
}
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
104,
14
]
]
}
]
},
"content": [
{
Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/api/advanced-action.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,18 @@
]
},
"content": "200"
}
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
84,
14
]
]
}
]
},
"content": [
{
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/asset.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
73,
32
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/headers.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
73,
32
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/payload-attributes.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
73,
32
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/api/relation.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,18 @@
]
},
"content": "200"
}
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
91,
14
]
]
}
]
},
"content": [
{
Expand Down
Loading

0 comments on commit 65176e8

Please sign in to comment.