Skip to content

Question about form-data #185

Description

@metita

Is there a brief tutorial on how to do a post request with form-data?

We tried several things, headers, post/get without success, we even tested through Postman and that worked flawlessly.

public fnTest(id){
    new GripJSONValue:data = grip_json_init_object();
    grip_json_object_set_string(data, "id", "1");
    grip_json_object_set_string(data, "email", "test@test.com");
    grip_json_object_set_string(data, "password", "testpw");

    new GripBody:body = grip_body_from_json(data);

    new GripRequestOptions:options = grip_create_default_options();
    //grip_options_add_header(options, "Content-Type", "application/json");
    //grip_options_add_header(options, "Content-Type", "multipart/form-data"); 
    grip_options_add_header(options, "User-Agent", "Grip");
    
    grip_request(
        "https://www.test.net/vinc.php", 
        body, 
        GripRequestTypePost, 
        "handlerTest", 
        options,
        id
    );
    grip_destroy_json_value(data);
    grip_destroy_body(body);
    grip_destroy_options(options);
}  

Are we doing something wrong? Content-Type form-data seems to be the only one with problems, any other post/get request works without problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions