Skip to content

Logical issue when sending parameters as JSON #50

@svilon

Description

@svilon

There is a logical issue when creating request with sendParametersAsJSON=YES;

In SVHTTPClient.m:

  • (SVHTTPRequest_)queueRequest:(NSString_)path
    method:(SVHTTPRequestMethod)method
    parameters:(NSDictionary_)parameters
    saveToPath:(NSString_)savePath
    progress:(void (^)(float))progressBlock
    completion:(SVHTTPRequestCompletionHandler)completionBlock {

{...}
SVHTTPRequest *requestOperation = [(id)[SVHTTPRequest alloc] initWithAddress:completeURLString
method:method
parameters:mergedParameters
saveToPath:savePath
sendAsJSON:self.sendParametersAsJSON
progress:progressBlock
completion:completionBlock];
return [self queueRequest:requestOperation];
}

  • (SVHTTPRequest_)queueRequest:(SVHTTPRequest_)requestOperation {
    requestOperation.sendParametersAsJSON = self.sendParametersAsJSON;
    {...}
    return requestOperation;
    }

requestOperation.sendParametersAsJSON will be set to YES after initialization, but in SVHTTPRequest.m addParametersToRequest: method is called inside of init method and at that time sendParametersAsJSON is always NO. As a result, I'm unable to send parameters as JSON :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions