MCPcopy Create free account
hub / github.com/EsperoTech/yaade / BodyElement

Class BodyElement

server/src/main/java/com/postman/collection/BodyElement.java:92–752  ·  view source on GitHub ↗

Encapsulates the body property of a com.postman.collection.Request object. Postman SDK analog: RequestBody There are several different permutations for this property dependin

Source from the content-addressed store, hash-verified

90 *
91 */
92public class BodyElement extends CollectionElement {
93
94
95
96 private GraphQLElement graphql;
97 private PropertyList<Property> formdata;
98 private PropertyList<Property> urlencoded;
99 private BinaryFileElement file;
100
101 /**
102 * @return String
103 */
104 public String getKey() {
105 return this.getUUID().toString();
106 }
107 /**
108 *
109 * Constructs a body with the provided <code>mode</code>, content, and language. If <code>mode</code> is not raw, the language value is discarded.
110 *
111 * @param mode Enumerated value for the underying <code>mode</code> property of this request body
112 * @param content The content in the body
113 * @param language For bodies with <code>mode</code> RAW, the language of the body content, e.g., <code>javascript</code>
114 */
115 public BodyElement(enumRequestBodyMode mode, String content, enumRawBodyLanguage language) {
116
117 this.setMode(mode);
118
119 if (this.getMode() == enumRequestBodyMode.RAW) {
120 try {
121 this.setOptions(new BodyOptions(language));
122 this.setRaw(content);
123 }
124 catch(IllegalPropertyAccessException e)
125 {
126 e.printStackTrace();
127 }
128
129 }
130
131 if (this.getMode() == enumRequestBodyMode.FILE) {
132 this.file.setSrc(content);
133 }
134
135 }
136
137 /**
138 * Convenience constructor, creates an empty body object of the specified mode
139 *
140 *
141 * @param mode Enumerated value for the <code>mode</code> property
142 */
143 public BodyElement(enumRequestBodyMode mode) {
144 this.setMode(mode);
145 }
146
147
148
149

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected