Skip to content

Commit f261a00

Browse files
committed
sequence: handle 206
1 parent 2051691 commit f261a00

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

assets/templates/partials/parse_form_partial.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<label class="form-row">
3333
Actor distance:
34-
<input name="distance" type="number" min="50" max="500" value="{{ .Sequence.Distance -}}" step="5">
34+
<input name="distance" type="number" min="50" max="1000" value="{{ .Sequence.Distance -}}" step="5">
3535
</label>
3636
<label class="form-row">
3737
Step height:

internal/server/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func indexHandler(version string) func(http.ResponseWriter, *http.Request) {
1515
data := html.PageData{Version: version}
1616

1717
// Default values
18-
data.Sequence.Distance = 200
18+
data.Sequence.Distance = 350
1919
data.Sequence.StepHeight = 40
2020
data.Sequence.IncludeCalls = false
2121
data.Sequence.IncludeReturns = false

render/sequence.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,29 @@ func addTransactionLogs(s *svgsequence.Sequence, ts vsl.TransactionSet, tx *vsl.
190190
case "deliver":
191191
switch tx.TXType {
192192
case vsl.TxTypeRequest:
193-
lastStatus := tx.LastRecordByTag(tags.RespStatus, i)
193+
status := tx.LastRecordByTag(tags.RespStatus, i)
194+
reason := tx.LastRecordByTag(tags.RespReason, i)
194195
// If a RespStatus is not found, we are probably serving a cache hit
195-
if lastStatus != nil {
196-
s1 := "DELIVER\n" + lastStatus.GetRawValue()
197-
lastReason := tx.LastRecordByTag(tags.RespReason, i)
198-
if lastReason != nil {
199-
s1 += " " + wrapAndTruncate(lastReason.GetRawValue(), truncateLen, 100)
196+
if status != nil {
197+
s1 := "DELIVER\n" + status.GetRawValue()
198+
if reason != nil {
199+
s1 += " " + wrapAndTruncate(reason.GetRawValue(), truncateLen, 100)
200+
}
201+
s.AddStep(svgsequence.Step{Source: V, Target: client, Text: s1})
202+
}
203+
204+
// Handle 200 --> 206 (partial content) by checking the next status
205+
status = tx.NextRecordByTag(tags.RespStatus, i)
206+
reason = tx.NextRecordByTag(tags.RespReason, i)
207+
contentRange := tx.RespHeaders.Get("Content-Range", false)
208+
if status != nil {
209+
s1 := "DELIVER\n"
210+
if contentRange != "" {
211+
s1 += "Content-Range: " + contentRange + "\n"
212+
}
213+
s1 += status.GetRawValue()
214+
if reason != nil {
215+
s1 += " " + wrapAndTruncate(reason.GetRawValue(), truncateLen, 100)
200216
}
201217
s.AddStep(svgsequence.Step{Source: V, Target: client, Text: s1})
202218
}

0 commit comments

Comments
 (0)