Как я могу изменить параметр "boundary" чтобы сгенерировать сигнатуру заголовка используя тело? Желательно только используя библиотеку OpenFeign

Основная проблема в том, что OpenFeign генерирует эти ключи по времени в этом классе:

public class MultipartFormContentProcessor implements ContentProcessor {
private final Deque<Writer> writers = new LinkedList();
private final Writer defaultPerocessor;

/constructor/

public void process(RequestTemplate template, Charset charset, Map<String, Object> data) throws EncodeException {
    String boundary = Long.toHexString(System.currentTimeMillis());
    Output output = new Output(charset);
    Iterator var6 = data.entrySet().iterator();

    while(var6.hasNext()) {
        Entry<String, Object> entry = (Entry)var6.next();
        if (entry != null && entry.getKey() != null && entry.getValue() != null) {
            Writer writer = this.findApplicableWriter(entry.getValue());
            writer.write(output, boundary, (String)entry.getKey(), entry.getValue());
        }
    }

    output.write("--").write(boundary).write("--").write("\r\n");
    String contentTypeHeaderValue = this.getSupportedContentType().getHeader() + "; charset=" + charset.name() + "; boundary=" + boundary;
    template.header("Content-Type", Collections.emptyList());
    template.header("Content-Type", new String[]{contentTypeHeaderValue});
    byte[] bytes = output.toByteArray();
    Body body = Body.encoded(bytes, (Charset)null);
    template.body(body);

    try {
        output.close();
    } catch (IOException var10) {
        throw new EncodeException("Output closing error", var10);
    }
}

Или может есть способ отправить в клиента уже готовое тело, которое не будет преобразовываться?


Ответы (0 шт):