Skip to content

Commit a5be1c8

Browse files
committed
produce valid apib file
1 parent 26c116b commit a5be1c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/body.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,6 @@ func (b *Body) SanitizedMultipartForm() string {
8383
}
8484
}
8585

86-
return string(bytes.Join(parts, []byte(boundary)))
86+
out := string(bytes.Join(parts, []byte(boundary)))
87+
return strings.Replace(out, "\n", "\n ", -1)
8788
}

doc/util.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ func cloneBody(r io.ReadCloser) (*bytes.Buffer, *bytes.Buffer, error) {
3535
func CopyHeader(dst, src http.Header) {
3636
for k, vv := range src {
3737
for _, v := range vv {
38+
if v == "" {
39+
v = "''" // to make the apiary doc valid
40+
}
3841
dst.Add(k, v)
3942
}
4043
}

0 commit comments

Comments
 (0)