기본적으로 Indy 라이브러리는 ContentText나 ContentStream이 할당되지 않은 경우 HTTP 응답에 콘텐츠 본문을 추가합니다. 빈 응답 본문을 반환하려는 경우(404 오류 등), 다음 접근 방식을 사용할 수 있습니다.
콘텐츠 없이 새 TStringStream을 생성하고 이를 HTTP Response의 ContentStream 속성에 할당하십시오. 이렇게 하면 HTTP 응답이 기본 HTML 태그 없이 전송됩니다.
예제
procedure OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
begin
AResponseInfo.ContentStream := TStringStream.Create('');
AResponseInfo.ContentType := 'text/html';
AResponseInfo.ResponseNo := 404;
end;