dart - How to get the HTTP response text from a HttpRequest.postFormData's catchError's _XMLHttpRequestProgressEvent? -


निम्न छद्म कोड को देखते हुए:

  आयात "डार्ट: html"; HttpRequest.postFormData (url, डेटा) .then ((HttpRequest अनुरोध) {...}) catchError ((त्रुटि) {// मैं यहां से प्रतिक्रिया पाठ कैसे प्राप्त करूं?});  

यदि वेब सर्वर एक 400 BAD अनुरोध के साथ उत्तर देता है तो catchError को लागू किया जाएगा। हालांकि, त्रुटि पैरामीटर प्रकार _XMLHttpRequestProgressEvent है जो जाहिरा तौर पर डार्ट की लाइब्रेरी में मौजूद नहीं है।

तो, मैं कैसे 400 BAD से प्रतिक्रिया पाठ प्राप्त कर सकता हूं अनुरोध प्रतिक्रिया जो वेब सर्वर से भेजी गई थी?

ऐसा लगता है कि आपके लक्ष्य

आप ऐसा कुछ कर सकते हैं:

 

आप यह लिंक उपयोगी पा सकते हैं:

> आयात करें "डार्ट: html"; HttpRequest.postFormData (url, डेटा) .then ((HttpRequest अनुरोध) {request.onReadyStateChange.listen ((प्रतिक्रिया) = & gt; / * प्रतिक्रिया के साथ sth * /);}। CatchError ((त्रुटि) {प्रिंट (त्रुटि .target.responseText); // वर्तमान लक्ष्य आपको एचटीपीआरएक्वेस्ट होना चाहिए});


Comments

Popular posts from this blog

c# - Reactive Extensions ControlScheduler -

ios - How to determine if NSLayoutConstraint is horizontal or vertical? -

javascript - Enable/Disable form elements and changing the values of button at a time? -