// Path: http-builder-ng-core/src/main/java/groovyx/net/http/util/Misc.java
// public static String randomString(final int size) {
//     final StringBuilder buffer = new StringBuilder(size);
//     for(int i = 0; i < size; ++i) {
//         buffer.append(theChars[current().nextInt(theChars.length)]);
//     }
// 
//     return buffer.toString();
// }


import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Consumer;
import static java.util.Collections.unmodifiableList;
import static groovyx.net.http.util.Misc.randomString;
/**
 * Copyright (C) 2017 HttpBuilder-NG Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package groovyx.net.http;



/**
 * Multipart request content object used to define the multipart data. An example would be:
 *
 * [source,groovy]
 * ----
 * request.contentType = 'multipart/form-data'
 * request.body = multipart {
 *     field 'userid','someuser'
 *     part 'icon', 'user-icon.jpg', 'image/jpeg', imageFile
 * }
 * ----
 *
 * which would define a `multipart/form-data` request with a field part and a file part with the specified properties.
 */
public class MultipartContent {
    
    private final List<MultipartPart> entries = new LinkedList<>();
// Path: http-builder-ng-core/src/main/java/groovyx/net/http/util/Misc.java
// public static String randomString(final int size) {
//     final StringBuilder buffer = new StringBuilder(size);
//     for(int i = 0; i < size; ++i) {
//         buffer.append(theChars[current().nextInt(theChars.length)]);
//     }
// 
//     return buffer.toString();
// }


// Path: http-builder-ng-core/src/main/java/groovyx/net/http/MultipartContent.java
import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Consumer;
import static java.util.Collections.unmodifiableList;
import static groovyx.net.http.util.Misc.randomString;

/**
 * Copyright (C) 2017 HttpBuilder-NG Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package groovyx.net.http;



/**
 * Multipart request content object used to define the multipart data. An example would be:
 *
 * [source,groovy]
 * ----
 * request.contentType = 'multipart/form-data'
 * request.body = multipart {
 *     field 'userid','someuser'
 *     part 'icon', 'user-icon.jpg', 'image/jpeg', imageFile
 * }
 * ----
 *
 * which would define a `multipart/form-data` request with a field part and a file part with the specified properties.
 */
public class MultipartContent {
    
    private final List<MultipartPart> entries = new LinkedList<>();
    private final String boundary = randomString(16);