File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -699,6 +699,31 @@ class Message {
699
699
}
700
700
}
701
701
702
+ /**
703
+ * Creates a `MessageIn` with the payload already being serialized.
704
+ *
705
+ * The payload is not normalized on the server (usually whitespace outside
706
+ * of string literals, unnecessarily escaped characters in string and such
707
+ * are fixed up by the server), and is not even required to be JSON.
708
+ *
709
+ * @param payload Serialized message payload
710
+ * @param contentType Content type of the payload to send as a header. Defaults to `application/json`.
711
+ *
712
+ * See the class documentation for details about the other parameters.
713
+ */
714
+ export function messageInRaw ( eventType : string , payload : string , contentType ?: string ) : MessageIn {
715
+ const headers = contentType ? { "content-type" : contentType } : undefined ;
716
+
717
+ return {
718
+ eventType,
719
+ payload : { } ,
720
+ transformationsParams : {
721
+ rawPayload : payload ,
722
+ headers,
723
+ }
724
+ } ;
725
+ }
726
+
702
727
class MessageAttempt {
703
728
private readonly api : MessageAttemptApi ;
704
729
You can’t perform that action at this time.
0 commit comments