cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daserge <...@git.apache.org>
Subject [GitHub] cordova-plugin-file-transfer pull request: uploadResponse encoding...
Date Mon, 26 Oct 2015 08:55:52 GMT
Github user daserge commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file-transfer/pull/71#discussion_r42969855
  
    --- Diff: src/ios/CDVFileTransfer.m ---
    @@ -552,6 +552,8 @@ - (void)connectionDidFinishLoading:(NSURLConnection*)connection
     
         if (self.direction == CDV_TRANSFER_UPLOAD) {
             uploadResponse = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
    +        if (uploadResponse == nil)
    +            uploadResponse = [[NSString alloc] initWithData: self.responseData encoding:NSISOLatin1StringEncoding];
    --- End diff --
    
    @codable, I want to remind you to sign ICLA - please do it so that your code could be
pulled in:
    http://www.apache.org/dev/new-committers-guide.html#cla
    
    You can use [cordova-plugin-test-framework](https://github.com/apache/cordova-plugin-test-framework)
for testing; please find the workflow described in [this comment](https://github.com/apache/cordova-wp8/pull/79#issuecomment-99734573).
    
    I used the following extra test for this PR (its the same as `filetransfer.spec.18` just
with updated url):
    ```javascript
                    it("filetransfer.spec.18b should be able to upload a file and handle non-UTF8
encoded response", function (done) {
                                                                                         
                                            
                        var fileURL = SERVER + '/upload_non_utf';                        
                                            
                                                                                         
                                            
                        var uploadWin = function (uploadResult) {                        
                                            
                                                                                         
                                            
                            verifyUpload(uploadResult);                                  
                                                
                                                                                         
                                            
                            if (cordova.platformId === 'ios') {                          
                                                
                                expect(uploadResult.headers).toBeDefined('Expected headers
to be defined.');                                  
                                expect(uploadResult.headers['Content-Type']).toBeDefined('Expected
content-type header to be defined.');      
                            }                                                            
                                                
                                                                                         
                                            
                            done();                                                      
                                                
                        };                                                               
                                            
                                                                                         
                                            
                        // NOTE: removing uploadOptions cause Android to timeout         
                                            
                        transfer.upload(localFilePath, fileURL, uploadWin, unexpectedCallbacks.httpFail,
uploadOptions);              
                    }, UPLOAD_TIMEOUT);                                                  
                                            
    ```
    
    To test the custom [file-transfer endpoint](https://github.com/apache/cordova-labs/blob/cordova-filetransfer/server.js)
I used Heroku (probably a local node server could also be used).
    To point the tests to another endpoint change [these lines](https://github.com/apache/cordova-plugin-file-transfer/blob/65d28795a6fb31a6eeae866ae5cfd02bfafdb28e/tests/tests.js#L42-L43).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message