Skip to content

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 Mar 23, 2016
1 parent ad6362a commit 570c9bf
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 6 deletions.
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
33 changes: 33 additions & 0 deletions test/fixtures/api/request-parameters.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
188,
33
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down Expand Up @@ -364,6 +375,17 @@
},
"content": "Only one user"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
361,
22
]
]
}
],
"hrefVariables": {
"element": "hrefVariables",
"content": [
Expand Down Expand Up @@ -431,6 +453,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
423,
33
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/resource-parameters.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
282,
33
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/schema-body.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,
53
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/schema-custom.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
11,
31
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down
26 changes: 24 additions & 2 deletions test/fixtures/api/transaction.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,18 @@
]
},
"content": "Normal"
}
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
73,
16
]
]
}
]
},
"content": [
{
Expand Down Expand Up @@ -199,7 +210,18 @@
]
},
"content": "200"
}
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
103,
14
]
]
}
]
},
"content": [
{
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/api/xml-body.sourcemap.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@
},
"content": "200"
},
"sourceMap": [
{
"element": "sourceMap",
"content": [
[
11,
31
]
]
}
],
"headers": {
"element": "httpHeaders",
"content": [
Expand Down

0 comments on commit 570c9bf

Please sign in to comment.