問題タブ [http-status-code-204]

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.

0 投票する
1 に答える
5938 参照

javascript - Firefox コンソールが HTTP 204 応答で「要素が見つかりません」をスローする

すべてが実際に機能しますが、Firefox コンソールでこのエラーを取り除くことができません。

要素が見つかりません

API に HTTP リクエストを送信しています。

私の(django restフレームワーク)APIはHTTP_204_NO_CONTENTステータスを返します

0 投票する
1 に答える
8634 参照

rest - HTTP GET 200 対 204

私たちはパブリック API を設計しており、次のケースで GET のベスト プラクティスを見つけようとしています。

パス パラメータ:

見つかった: 応答本文で 200。
見つかりません: 404。

クエリ パラメータ:

見つかった注文: 200 件、応答本文あり。

見つかりません: この場合、これは 200 または 204 または 404 である必要がありますか?

私の意見では、この場合リソースが見つかり、クエリパラメーターはフィルター効果のみを実行しているため、200 または 204 である必要があります。しかし、この場合、200 または 204 を返すべきでしょうか?

0 投票する
1 に答える
1588 参照

android - Android Volley Request から 204 No Content を検出する方法

私のAPIにリクエストすると、APIは204 - No Contentを返します。しかし、ボレーはそれを認識せず、TimeOutError を返します。

どうすればこれを処理できますか?

0 投票する
1 に答える
426 参照

javascript - 204レスポンス&コールバック機能付きビーコントラッキング画像

トラッキング ピクセル JS 機能を 204 "no_content" 応答を使用するように変換するために、数日間試みてきました。

これは簡単に機能させることができますが、後でコールバック関数を起動できるようにする必要があります。

204 が返されると、以下は起動されないようです。

追跡は適切に記録されますが、アラートまたはコンソール ログ メッセージは記録されません。これは可能ですか、それとも時間を無駄にしているだけですか?

編集 - - -

以下の解決策に基づいて、ここに最終バージョンがあります (これは、エラーと成功の両方が同じコールバックを使用することを前提としています。

0 投票する
2 に答える
996 参照

html - MSIE/Edge は HTTP HEAD を使用して data URLs, then treats 204 response as error?

Background:

Background:

My PHP code handles typical HTTP HEAD requests by sending either an HTTP status 404 response or a 204 response. This seems correct to me, since RFC7231 specifies HTTP status 204 as:

6.3.5. 204 No Content

The 204 (No Content) status code indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body. Metadata in the response header fields refer to the target resource and its selected representation after the requested action was applied...

The 204 response allows a server to indicate that the action has been successfully applied to the target resource, while implying that the user agent does not need to traverse away from its current "document view" (if any)...

A 204 response is terminated by the first empty line after the header fields because it cannot contain a message body...

https://www.rfc-editor.org/rfc/rfc7231#section-6.3.5

Since the user agent is only requesting the headers and not the file itself, 204 seems to fit.

Surprise #1:

When an <object> element has a URL for the data attribute, MSIE/Edge initially makes an HTTP HEAD request in order to determine the content-type via the response headers. While another MS quirk, it makes sense, as it allows the browser to pre-load the needed handlers in advance of receiving the content. When it receives a suitable response to the HEAD request, it will then make an HTTP GET request for the file itself.

Now, this wouldn't have been so much of an issue if it weren't for...

Surprise #2:

When MSIE/Edge receives a 204 response to its HEAD request, it treats it as an error and aborts loading the file.

This was, needless to say, quite frustrating to discover (the process and the discovery itself).

Have I misunderstood the purpose or usage of the 204 response? I know industry-usage often diverges from specifications, but this seems... wrong.


["randomChildKey3": [:], "randomChildKey2": [:], "randomChildKey1": [:]]

0 投票する
0 に答える
958 参照

angularjs - AngularJS: エラー 204 (コンテンツなし)

私はこのAngular Controllerを持っています:

ここに私のdataServiceファイルがあります:

この dataService.js は、次のようにリポジトリで GetOrganizationById メソッドを呼び出します。

リポジトリは情報を正常に取得し、dataService.js に送り返し、organizationController.js のこの行に到達します。Chrome デバッガーで確認できました。

ただし、次の行ではデータが失われ、システムは 204 エラー コード: データなしを返します。

コントローラーが変数「結果」で送信されるデータを受け入れない理由は何ですか?

私は Visual Studio 2015 EF と C# バックエンドで作業しています。しかし、情報を取得し、Postman でも表示されるため、問題はフロントエンドにあるだけです

0 投票する
1 に答える
9976 参照

ruby-on-rails - Rails 5テンプレートが見つかりませんエラー

実行中のターミナルでのエラーrails s:

これは実際には 204 No Content エラーとして渡される Rails の Unknown Format エラーのようです。私はレールに本当に慣れていないので、コースでこれを行っています。

def confirm私は1つのアクションを持つコントローラーを持っています。私のファイルのどこにも繰り返されていません。以前のほとんどの投稿とは異なり、respond_toこのアクション内にメソッドはありません。

エラーは実際にはどこから発生しますか? 構成を確認する必要があるのか​​、コントローラーを作り直す必要があるのか​​ わかりません

これは私のgemfileです:

edit.html.erb