Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify and optimize RemoveMagicPrefixLine.
If body has ")]}'\n" prefix, there's no need to use bytes.IndexByte to find the first '\n' character, it's known to be at index 4 because bytes.HasPrefix(body, []byte(")]}'\n")) was true. Since this is called often, it's probably a good idea to factor out []byte(")]}'\n") into a package scope variable, instead of potentially allocating once per RemoveMagicPrefixLine call.
- Loading branch information