Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about form-data #185

Open
metita opened this issue Jun 19, 2020 · 0 comments
Open

Question about form-data #185

metita opened this issue Jun 19, 2020 · 0 comments

Comments

@metita
Copy link

metita commented Jun 19, 2020

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", "[email protected]");
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant