MCPcopy Create free account
hub / github.com/apache/thrift / ParseStringBody

Method ParseStringBody

lib/go/thrift/simple_json_protocol.go:921–944  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

919}
920
921func (p *TSimpleJSONProtocol) ParseStringBody() (string, error) {
922 line, err := p.reader.ReadString(JSON_QUOTE)
923 if err != nil {
924 return "", NewTProtocolException(err)
925 }
926 if endsWithoutEscapedQuote(line) {
927 v, ok := jsonUnquote(string(JSON_QUOTE) + line)
928 if !ok {
929 return "", NewTProtocolException(err)
930 }
931 return v, nil
932 }
933 s, err := p.ParseQuotedStringBody()
934 if err != nil {
935 return "", NewTProtocolException(err)
936 }
937 str := string(JSON_QUOTE) + line + s
938 v, ok := jsonUnquote(str)
939 if !ok {
940 e := fmt.Errorf("Unable to parse as JSON string %s", str)
941 return "", NewTProtocolExceptionWithType(INVALID_DATA, e)
942 }
943 return v, nil
944}
945
946func (p *TSimpleJSONProtocol) ParseQuotedStringBody() (string, error) {
947 var sb strings.Builder

Callers 3

ReadFieldBeginMethod · 0.95
ReadStringMethod · 0.95
ReadStringMethod · 0.80

Calls 7

ParseQuotedStringBodyMethod · 0.95
NewTProtocolExceptionFunction · 0.85
endsWithoutEscapedQuoteFunction · 0.85
jsonUnquoteFunction · 0.85
stringFunction · 0.85
ReadStringMethod · 0.65

Tested by

no test coverage detected