Change JsonFraming to fail stage if completing within an object #29228

This commit is contained in:
Dave Handy 2020-07-03 11:22:40 -04:00 committed by GitHub
parent f6ceb4d49a
commit 2f2ee9e67c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 17 deletions

View file

@ -70,6 +70,9 @@ import akka.util.ByteString
def isEmpty: Boolean = buffer.isEmpty
/** `true` if the buffer is in a valid state to end framing. */
def canComplete: Boolean = !insideObject
/**
* Attempt to locate next complete JSON object in buffered ByteString and returns `Some(it)` if found.
* May throw a [[akka.stream.scaladsl.Framing.FramingException]] if the contained JSON is invalid or max object size is exceeded.