0
[_webServer addHandlerForMethod:@"GET" path:@"/111" requestClass:[GCDWebServerRequest class] asyncProcessBlock:^(GCDWebServerRequest *request, GCDWebServerCompletionBlock completionBlock) {

    GCDWebServerDataResponse *response = [GCDWebServerDataResponse responseWithJSONObject:@{
                                                                                        @"123":@"123"
                                                                                        }];
    completionBlock(response);
}];

I am an iOS developer with ObjC, found GCDWebServer very useful.but I want to simulate for setting my custom request(like json dictionary @{@"name":@"jim",@"age":@"20"}) ? I do not know how, can some one help me ,thx! (support GET/POST)

  • You need to make your question more precise: what exactly are you trying to achieve? It's not not needed to link to the GitHub issue. – Pol Sep 10 '15 at 05:58

1 Answers1

0

You can pass your custom parameters on the URI after the pathname like this using ?param=1 with param the name of the value and 1 is the value so the full URI would be for example :

http://192.168.105.18:8080/setLockBackLight?param=1

to get the parameter value using the GET method for example,simply access to the GCDWebServerRequest values like this :

NSArray *values = request.query.allValues;

BriniH
  • 35
  • 11