In HG Wells' "The World Set Free" (1914) flying machines deliver nuclear bombs but their pilots' heaviest defence / attack weapon is a handgun.
The plot is set in 1940s. But reality was well ahead the writer's imagination. If Mr. Wells took a better look around he could notice a flying machine armed with something serious - a cannon. Here is a short extract from "The Cannon Pioneers" by Anthony G Williams: "The earliest and the most persistent users of cannon-armed aircraft were the French. Despite the fact that early aircraft had considerable difficulty in lifting themselves and their pilots into the air, experiments with fitting large-calibre cannon took place even before World War I.
"In 1910 the Frenchman Gabriel Voisin installed a 37 mm cannon in one of his aeroplanes for publicity purposes, but it never flew with this armament. The next year, ground tests of a 37 mm Hotchkiss mounted in front of the propeller of a Blériot 11 wrecked the aircraft. In 1913, a 37 mm gun was finally fired from a "Voisin Canon," a modified Voisin model 1913 with a 37 mm Hotchkiss cannon and a 200 hp engine.
"The first of the French 37 mm airborne cannon was the powerful M1902 "Tube Canon" which fired a 37x201R cartridge. The other common French aircraft weapon in this calibre was the short-barrelled naval Hotchkiss M1885, chambered for the low-velocity 37x94R cartridge. The M1885 was later modified with a smoothbore barrel to fire the "shotgun cartridge" shells in some fighters, as a rifled barrel disturbed the pattern of shot.
Numerous French units used cannon-armed Voisins. For instance, 111th Squadron (above and two pictures below).
Voisin cockpit by BillKatyGemma @ Flickr