• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TykTechnologies / tyk / 2806 / 2

Build:
DEFAULT BRANCH: master
Ran 29 Aug 2017 02:23PM UTC
Files 84
Run time 7s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Aug 2017 02:19PM UTC coverage: 43.822% (+0.005%) from 43.817%
LATEST_GO=true

push

travis-ci

mvdan
plugin: marshal body into json as []byte

The encoding/json godoc reads:

	String values encode as JSON strings coerced to valid UTF-8,
	replacing invalid bytes with the Unicode replacement rune.

	... []byte encodes as a base64-encoded string, ...

We need to marshal the body as a []byte, not a string. Since JSON needs
to be valid UTF-8, we can't just keep the bytes as-is.

We can't simply quote the string, as JSON does not have a way to escape
bytes like \xff. It does have \u, but that is only for valid unicode
characters, which binary bytes may not be.

Using []byte in JSON means encoding to base64 in Go, so we must
introduce functions in the JSVM to decode and encode base64. This is so
that JS plugins can replace or modify the body in plaintext, not base64.
This is required for backwards compatibility.

This may or may not work in some JS implementations depending on whether
or not their strings can contain non-UTF8. Luckily, Otto supports that
just fine. We check this via the added test, which has ASCII, non-ASCII
unicode and non-unicode characters in one string that is modified.

Fixes #351.

5955 of 13589 relevant lines covered (43.82%)

0.47 hits per line

Source Files on job 2806.2 (LATEST_GO=true)
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2806
  • Travis Job 2806.2
  • cec74eea on github
  • Prev Job for LATEST_GO=true on master (#2802.2)
  • Next Job for LATEST_GO=true on master (#2817.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc