Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  json_multipart.sjs   Sprache: unbekannt

 
Untersuchungsergebnis.sjs Download desUnknown {[0] [0] [0]}

"use strict";

const BOUNDARY = "boundary";
const JSON_DATA = `Content-Type: application/vnd.mozilla.json.view

{ "hello": "world" }`;

const HTML = `Content-Type: text/html

<html>
  <body>Test multipart</body>
</html>`;

async function handleRequest(request, response) {
  response.processAsync();

  response.setHeader(
    "Content-Type",
    `multipart/x-mixed-replace; boundary=${BOUNDARY}`,
    false
  );
  response.setStatusLine(request.httpVersion, "200", "OK");

  response.write(`--${BOUNDARY}\n`);
  response.write(`${JSON_DATA}\n`);
  response.write(`--${BOUNDARY}\n`);

  await sleep(1000);

  response.write(`${HTML}\n`);
  response.write(`--${BOUNDARY}--\n`);
  response.finish();
}

function sleep(delay) {
  return new Promise(res =>
    Cc["@mozilla.org/timer;1"]
      .createInstance(Ci.nsITimer)
      .init(res, delay, Ci.nsITimer.TYPE_ONE_SHOT)
  );
}

[zur Elbe Produktseite wechseln0.48Quellennavigators]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002