Comments (18)
I'd say, yes, it should handle this and this is a bug. Let me look into it.
from promisekit.
Well, this isn't strictly a header only response. It claims the response length is 1 and the content is JSON. PromiseKit reads that and tries to decode JSON from the 1 byte response and fails, so fails the response.
Not sure what to do here.
from promisekit.
For now you can do:
- (PMKPromise *)myPromise:(id)args {
id rq = [OMGHTTPURLRQ POST:url:args];
id q = ;
return [PMKPromise new:^(PMKPromiseFulfiller fulfill, PMKPromiseRejecter reject){
[NSURLConnection sendAsynchronousRequest:rq queue:q completionHandler:^(id rsp, id data, NSError *urlError) {
if (urlError) {
reject(urlError)
} else {
fulfill(nil);
}
}];
}];
}
from promisekit.
thank you for the snippet, will try it out and report :)
from promisekit.
You'll need to #import <OMGHTTPURLRQ.h>
too. That will work as PromiseKit depends on it.
from promisekit.
Closing as I believe the issue is the web-server’s response is invalid.
from promisekit.
Turns out this is a common Rails work around. So I have hard-coded detection in v0.9.14.3 that will allow it.
Let me know if it works.
from promisekit.
I have tried the OMGHTTPURLRQ approach (the snippet) to get header-only response from rails 4.1.4 (head 200), it worked as expected ('then' is called and 'catch' is not called)
from promisekit.
@mxcl
would like to try out v0.9.14.3, any way to install it using cocoapods?
I tried " pod 'PromiseKit', '0.9.14.3' " but it doesn't install (Error name: Unable to satisfy the following requirement)
from promisekit.
Does it not say what requirement it cannot satisfy?
from promisekit.
the only requirement
" pod 'PromiseKit', '0.9.14.3' "
from promisekit.
What CocoaPods command are you running to generate this error? More information please.
from promisekit.
i used "pod install --no-repo-update", the flag is used because executing "pod install" always remain at the step "analyzing dependency", adding the flag prevents the problem
from promisekit.
Without a repo update you cannot get the new PromiseKit, hence the error.
from promisekit.
ahhh, i get it, you are right. silly me.
from promisekit.
will try to pull version 0.9.14.3 and try it out
from promisekit.
Yes, PromiseKit version 0.9.14.3 worked as expected ( Rails 4.1.4 is used for server btw ), it correctly does the following:
head 200 response -> execute 'then' and then 'finally'
head 500 response -> execute 'catch' and then 'finally'
from promisekit.
For the sake of others' information, I solved the pod install hanging problem by executing the following commands:
pod repo remove master
pod setup
pod install
from promisekit.
Related Issues (20)
- Could not find Xcode version that satisfied version spec: '12.4' HOT 1
- Cannot use URLSession.shared.dataTask(.promise, with: url) in my project HOT 1
- Problems building with Xcode 14.3 beta2 HOT 5
- dependabot requests HOT 1
- Update Cocoapod Release Version? HOT 9
- Website taken over by someone else? HOT 3
- Cocoapods's pods that depend on PromiseKit 6.22.1+ fail to `pod lib lint` while using Xcode 14.3 HOT 6
- Undefined symbols for architecture arm64 : PromiseKit HOT 3
- Xcode 15 Warning HOT 1
- promiseWithBooleanAdapterBlock HOT 8
- Add support of visionOS HOT 1
- SPM doesn't compile properly with version 8.x.x HOT 4
- Maige Usage
- Maige Usage
- Maige Usage
- Maige Usage
- Privacy Manifest HOT 16
- Request to updated SDK with the Privacy Manifest HOT 2
- Access authority HOT 3
- Release latest code to cocoapod HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from promisekit.