Skip to content

Restfuse POST file does not frame the request correctly #64

Description

@gammay

Following is the restfuse test case to send a file:

    @HttpTest(method = Method.POST, path = "/api/test/file/v1", 
            type = MediaType.MULTIPART_FORM_DATA,
            headers = {
                @Header(name = "Content-Type", value = "multipart/form-data; boundary=--ABC")
            },
            file = "/test.txt"
    )
    public void testPostFile() {
        Assert.assertOk(response);
    }

This sends HTTP request as below:

POST http://localhost:8888/api/test/file/v1 HTTP/1.1
Content-Type: multipart/form-data; boundary=--ABC
User-Agent: Java/1.7.0_21
Host: localhost:8888
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 9

TEST!!!

When the same request is sent through Postman chrome extension, the request is:

POST http://localhost:8080/api/test/file/v1 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 191
Cache-Control: no-cache
Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm
type: multipart/form-data
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryegsX8TPws99lAi9O
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: __atuvc=1%7C39; CUSTOMER_UUID=cd9fbf8b-1248-4773-80fe-917d7abd0a38

------WebKitFormBoundaryegsX8TPws99lAi9O
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

TEST!!!

------WebKitFormBoundaryegsX8TPws99lAi9O--

Restfuse does not seem to add the file boundaries automatically. What are we missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions