問題タブ [nshttpurlresponse]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
swift - 500 の http エラーを処理する方法
HTTPURLResponse
関数を使用して、クラス( URLResponse
)の 500 エラーのカスタム サーバー応答本文にアクセスしようとしていますURLSession.shared.dataTask
。statusCode
andにしかアクセスできallHeaderFields
ませんが、役に立たないようです。
exのJavaで同等です。ですがHttpURLConnection.getErrorStream()
、純粋なswiftで同様のものを見つけることができません(サードパーティのライブラリを使用せずにこれを解決したいと思います)。
500 エラーのテキスト応答を取得するにはどうすればよいですか?